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

noreply.seb at qos.ch noreply.seb at qos.ch
Tue Jul 25 10:39:14 CEST 2006


Author: seb
Date: Tue Jul 25 10:39:13 2006
New Revision: 270

Modified:
   logback/classic/trunk/src/main/java/ch/qos/logback/classic/Logger.java
Log:
if the logger doesn't write anything, it sends an error to his context

Modified: logback/classic/trunk/src/main/java/ch/qos/logback/classic/Logger.java
==============================================================================
--- logback/classic/trunk/src/main/java/ch/qos/logback/classic/Logger.java	(original)
+++ logback/classic/trunk/src/main/java/ch/qos/logback/classic/Logger.java	Tue Jul 25 10:39:13 2006
@@ -22,6 +22,7 @@
 import ch.qos.logback.core.filter.Filter;
 import ch.qos.logback.core.spi.AppenderAttachable;
 import ch.qos.logback.core.spi.AppenderAttachableImpl;
+import ch.qos.logback.core.status.ErrorStatus;
 
 
 public final class Logger implements org.slf4j.Logger, AppenderAttachable {
@@ -263,7 +264,9 @@
     }
 
     // No appenders in hierarchy
-    // FIXME: add an error to the error list
+    if (writes == 0) {
+    	loggerContext.noAppenderDefinedWarning(this);
+    }
   }
 
   private int appendLoopOnAppenders(LoggingEvent event) {
@@ -668,4 +671,12 @@
   public String toString() {
     return "Logger[" + name + "]";
   }
+
+  /**
+   * Return the context for this logger.
+   * @return
+   */
+	public LoggerContext getLoggerContext() {
+		return loggerContext;
+	}
 }



More information about the logback-dev mailing list