* weak hashmap is used to ensure no classloader reference is leaked from \r
* application redeployment.\r
*/\r
- protected final Map classLoaderLoggers = new WeakHashMap();\r
+ protected final Map<ClassLoader, ClassLoaderLogInfo> classLoaderLoggers = \r
+ new WeakHashMap<ClassLoader, ClassLoaderLogInfo>();\r
\r
\r
/**\r
* This prefix is used to allow using prefixes for the properties names\r
* of handlers and their subcomponents.\r
*/\r
- protected ThreadLocal prefix = new ThreadLocal();\r
+ protected ThreadLocal<String> prefix = new ThreadLocal<String>();\r
\r
\r
// --------------------------------------------------------- Public Methods\r
* Get an enumeration of the logger names currently defined in the \r
* classloader local configuration.\r
*/\r
- public synchronized Enumeration getLoggerNames() {\r
+ public synchronized Enumeration<String> getLoggerNames() {\r
ClassLoader classLoader = Thread.currentThread()\r
.getContextClassLoader();\r
return Collections.enumeration(getClassLoaderInfo(classLoader).loggers.keySet());\r
}\r
ClassLoaderLogInfo info = \r
new ClassLoaderLogInfo(new LogNode(null, localRootLogger));\r
- info.loggers.put("", localRootLogger);\r
classLoaderLoggers.put(classLoader, info);\r
\r
if (is != null) {\r
readConfiguration(is, classLoader);\r
}\r
+ addLogger(localRootLogger);\r
\r
}\r
\r
protected static final class LogNode {\r
Logger logger;\r
\r
- protected final Map children = new HashMap();\r
+ protected final Map<String, LogNode> children = \r
+ new HashMap<String, LogNode>();\r
\r
protected final LogNode parent;\r
\r
\r
LogNode findNode(String name) {\r
LogNode currentNode = this;\r
+ if (logger.getName().equals(name)) {\r
+ return this;\r
+ }\r
while (name != null) {\r
final int dotIndex = name.indexOf('.');\r
final String nextName;\r
\r
protected static final class ClassLoaderLogInfo {\r
final LogNode rootNode;\r
- final Map loggers = new HashMap();\r
- final Map handlers = new HashMap();\r
+ final Map<String, Logger> loggers = new HashMap<String, Logger>();\r
+ final Map<String, Handler> handlers = new HashMap<String, Handler>();\r
final Properties props = new Properties();\r
\r
ClassLoaderLogInfo(final LogNode rootNode) {\r