When adding a logger, its better to always add the parent loggers, all the way up...
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 10 Mar 2009 18:53:27 +0000 (18:53 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 10 Mar 2009 18:53:27 +0000 (18:53 +0000)
The cost of this is relatively small, since the number of packages compared to classes is relatively small.
This feature allows extensions of the JULI framework to change log categories during run time, as opposed to changing them for every single logger in a category

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@752215 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/juli/ClassLoaderLogManager.java

index 0a5f2f7..f065cf7 100644 (file)
@@ -101,15 +101,12 @@ public class ClassLoaderLogManager extends LogManager {
             }
         }
 
-        // If any parent loggers have levels definied, make sure they are
-        // instantiated
+        // Always instantiate parent loggers so that 
+        // we can control log categories even during runtime
         int dotIndex = loggerName.lastIndexOf('.');
         while (dotIndex >= 0) {
             final String parentName = loggerName.substring(0, dotIndex);
-            if (getProperty(parentName + ".level") != null) {
-                Logger.getLogger(parentName);
-                break;
-            }
+            Logger.getLogger(parentName);
             dotIndex = loggerName.lastIndexOf('.', dotIndex - 1);
         }