logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@apache.org
Subject svn commit: r427679 - /logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/varia/FallbackErrorHandler.java
Date Tue, 01 Aug 2006 19:03:26 GMT
Author: carnold
Date: Tue Aug  1 12:03:25 2006
New Revision: 427679

URL: http://svn.apache.org/viewvc?rev=427679&view=rev
Log:
Bug 15501: FallbackErrorHandler throws NPE if no loggers are set

Modified:
    logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/varia/FallbackErrorHandler.java

Modified: logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/varia/FallbackErrorHandler.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/varia/FallbackErrorHandler.java?rev=427679&r1=427678&r2=427679&view=diff
==============================================================================
--- logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/varia/FallbackErrorHandler.java
(original)
+++ logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/varia/FallbackErrorHandler.java
Tue Aug  1 12:03:25 2006
@@ -84,17 +84,18 @@
   void error(String message, Exception e, int errorCode, LoggingEvent event) {
     LogLog.debug("FB: The following error reported: " + message, e);
     LogLog.debug("FB: INITIATING FALLBACK PROCEDURE.");
-    for(int i = 0; i < loggers.size(); i++) {
-      Logger l = (Logger) loggers.elementAt(i);
-      LogLog.debug("FB: Searching for ["+primary.getName()+"] in logger ["
-		   +l.getName() + "].");
-      //if(l.isAttached(primary)) {
-      LogLog.debug("FB: Replacing ["+primary.getName()+"] by ["
-		   + backup.getName() + "] in logger ["+ l.getName() +"].");
-      l.removeAppender(primary);
-      LogLog.debug("FB: Adding appender ["+backup.getName()+"] to logger "
-		   +  l.getName());
-      l.addAppender(backup);
+    if (loggers != null) {
+    	for(int i = 0; i < loggers.size(); i++) {
+      		Logger l = (Logger) loggers.elementAt(i);
+      		LogLog.debug("FB: Searching for ["+primary.getName()+"] in logger ["
+		   		+l.getName() + "].");
+      		LogLog.debug("FB: Replacing ["+primary.getName()+"] by ["
+		   		+ backup.getName() + "] in logger ["+ l.getName() +"].");
+      		l.removeAppender(primary);
+      		LogLog.debug("FB: Adding appender ["+backup.getName()+"] to logger "
+		   		+  l.getName());
+      		l.addAppender(backup);
+        }
     }    
   }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message