[LOGBack-dev] svn commit: r461 - logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic

noreply.seb at qos.ch noreply.seb at qos.ch
Fri Aug 11 19:03:05 CEST 2006


Author: seb
Date: Fri Aug 11 19:03:04 2006
New Revision: 461

Modified:
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java
Log:
- added a test case to be sure that the LoggerContext doesn't get flooded with messages when no appenders are configured
related bug: id=2

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/LoggerContextTest.java	Fri Aug 11 19:03:04 2006
@@ -9,10 +9,8 @@
  */
 package ch.qos.logback.classic;
 
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
-import junit.framework.*;
+import junit.framework.TestCase;
+import ch.qos.logback.core.status.StatusManager;
 
 public class LoggerContextTest extends TestCase {
   LoggerContext lc;
@@ -111,5 +109,16 @@
     LoggerTestHelper.assertLevels(null, lc.getLogger("w.x.y"), Level.INFO);
     LoggerTestHelper.assertLevels(null, wxyz, Level.INFO);
   }
+  
+  public void testStatusWithUnconfiguredContext() {
+  	Logger logger = lc.getLogger(LoggerContextTest.class);
+  	
+  	for (int i = 0; i < 10; i++) {
+  		logger.debug("test");
+  	}
+
+  	StatusManager sm = lc.getStatusManager();
+  	assertTrue("StatusManager has recieved too many messages", sm.getCount() == 1);
+  }
 
 }
\ No newline at end of file



More information about the logback-dev mailing list