/** * Logback: the reliable, generic, fast and flexible logging framework. * Copyright (C) 1999-2009, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by * the Eclipse Foundation * * or (per the licensee's choosing) * * under the terms of the GNU Lesser General Public License version 2.1 * as published by the Free Software Foundation. */ package ch.qos.logback.classic; import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactoryFriend; import org.slf4j.impl.StaticLoggerBinderFriend; import ch.qos.logback.classic.util.ContextInitializer; import ch.qos.logback.core.status.StatusManager; import ch.qos.logback.core.util.StatusPrinter; public class AsyncAppenderInitializationTest { @Before public void setUp() throws Exception { System.setProperty(ContextInitializer.CONFIG_FILE_PROPERTY, "AsyncAppender_logback-test.xml"); StaticLoggerBinderFriend.reset(); LoggerFactoryFriend.reset(); } @After public void tearDown() throws Exception { System.clearProperty(ContextInitializer.CONFIG_FILE_PROPERTY); } @Test public void testLogbackInitialization() { Logger logger = LoggerFactory .getLogger("AsyncAppenderInitializationTest"); logger.info("AsyncAppenderInitializationTest"); LoggerContext loggerContext = (LoggerContext) LoggerFactory .getILoggerFactory(); StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext); StatusManager sm = loggerContext.getStatusManager(); assertEquals("Was expecting no errors", 0, sm.getLevel()); } }