From: remm Date: Fri, 7 Jul 2006 22:42:46 +0000 (+0000) Subject: - Should improve handling of the root logger (sorry, I don't know who submitted this... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7781bb580edaeca0aba1f15dcab964fb68b71c4b;p=tomcat7.0 - Should improve handling of the root logger (sorry, I don't know who submitted this, it was a while ago). git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@420008 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/juli/ClassLoaderLogManager.java b/java/org/apache/juli/ClassLoaderLogManager.java index 528bf3cda..af79155ff 100644 --- a/java/org/apache/juli/ClassLoaderLogManager.java +++ b/java/org/apache/juli/ClassLoaderLogManager.java @@ -51,14 +51,15 @@ public class ClassLoaderLogManager extends LogManager { * weak hashmap is used to ensure no classloader reference is leaked from * application redeployment. */ - protected final Map classLoaderLoggers = new WeakHashMap(); + protected final Map classLoaderLoggers = + new WeakHashMap(); /** * This prefix is used to allow using prefixes for the properties names * of handlers and their subcomponents. */ - protected ThreadLocal prefix = new ThreadLocal(); + protected ThreadLocal prefix = new ThreadLocal(); // --------------------------------------------------------- Public Methods @@ -179,7 +180,7 @@ public class ClassLoaderLogManager extends LogManager { * Get an enumeration of the logger names currently defined in the * classloader local configuration. */ - public synchronized Enumeration getLoggerNames() { + public synchronized Enumeration getLoggerNames() { ClassLoader classLoader = Thread.currentThread() .getContextClassLoader(); return Collections.enumeration(getClassLoaderInfo(classLoader).loggers.keySet()); @@ -334,12 +335,12 @@ public class ClassLoaderLogManager extends LogManager { } ClassLoaderLogInfo info = new ClassLoaderLogInfo(new LogNode(null, localRootLogger)); - info.loggers.put("", localRootLogger); classLoaderLoggers.put(classLoader, info); if (is != null) { readConfiguration(is, classLoader); } + addLogger(localRootLogger); } @@ -472,7 +473,8 @@ public class ClassLoaderLogManager extends LogManager { protected static final class LogNode { Logger logger; - protected final Map children = new HashMap(); + protected final Map children = + new HashMap(); protected final LogNode parent; @@ -487,6 +489,9 @@ public class ClassLoaderLogManager extends LogManager { LogNode findNode(String name) { LogNode currentNode = this; + if (logger.getName().equals(name)) { + return this; + } while (name != null) { final int dotIndex = name.indexOf('.'); final String nextName; @@ -538,8 +543,8 @@ public class ClassLoaderLogManager extends LogManager { protected static final class ClassLoaderLogInfo { final LogNode rootNode; - final Map loggers = new HashMap(); - final Map handlers = new HashMap(); + final Map loggers = new HashMap(); + final Map handlers = new HashMap(); final Properties props = new Properties(); ClassLoaderLogInfo(final LogNode rootNode) {