[logback-dev] svn commit: r812 - in logback/trunk/logback-classic/src: main/java/ch/qos/logback/classic test/java/ch/qos/logback/classic/util

noreply.ceki at qos.ch noreply.ceki at qos.ch
Sun Oct 29 22:21:11 CET 2006


Author: ceki
Date: Sun Oct 29 22:21:11 2006
New Revision: 812

Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationTest.java

Log:

ongoing work on auto configuration, and reset procedure

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/Logger.java	Sun Oct 29 22:21:11 2006
@@ -340,6 +340,9 @@
   void recursiveReset() {
     detachAndStopAllAppenders();
     additive = true;
+    if(childrenList == null) {
+      return;
+    }
     for(Logger childLogger: childrenList) {
       childLogger.recursiveReset();
     }

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/util/InitializationTest.java	Sun Oct 29 22:21:11 2006
@@ -2,30 +2,46 @@
 
 import junit.framework.TestCase;
 
-
 import org.slf4j.LoggerFactory;
 
 import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.core.Appender;
 import ch.qos.logback.core.ConsoleAppender;
 
 public class InitializationTest extends TestCase {
 
+  org.slf4j.Logger logger = LoggerFactory.getLogger(InitializationTest.class);
+  LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
+  Logger root = (Logger) LoggerFactory.getLogger("root");
+
   protected void setUp() throws Exception {
     super.setUp();
+    logger.debug("Hello-didily-odily");
+
   }
 
   protected void tearDown() throws Exception {
     super.tearDown();
   }
- 
-  public void test() {
-    org.slf4j.Logger logger = LoggerFactory.getLogger(InitializationTest.class);
-    logger.debug("Hello-didily-odily");
-    
-    Logger root = (Logger) LoggerFactory.getLogger("root");
+
+  public void testAutoconfig() {
     Appender appender = root.getAppender("STDOUT");
     assertNotNull(appender);
     assertTrue(appender instanceof ConsoleAppender);
   }
+
+  public void testReset() {
+    {
+      Appender appender = root.getAppender("STDOUT");
+      assertNotNull(appender);
+      assertTrue(appender instanceof ConsoleAppender);
+    }
+    {
+      lc.reset();
+      Appender appender = root.getAppender("STDOUT");
+      assertNull(appender);
+    }
+
+  }
 }



More information about the logback-dev mailing list