You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2006/07/08 00:42:46 UTC
svn commit: r420008 -
/tomcat/tc6.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java
Author: remm
Date: Fri Jul 7 15:42:46 2006
New Revision: 420008
URL: http://svn.apache.org/viewvc?rev=420008&view=rev
Log:
- Should improve handling of the root logger (sorry, I don't know who submitted this, it was a while
ago).
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java
Modified: tomcat/tc6.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java?rev=420008&r1=420007&r2=420008&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java Fri Jul 7 15:42:46 2006
@@ -51,14 +51,15 @@
* weak hashmap is used to ensure no classloader reference is leaked from
* application redeployment.
*/
- protected final Map classLoaderLoggers = new WeakHashMap();
+ protected final Map<ClassLoader, ClassLoaderLogInfo> classLoaderLoggers =
+ new WeakHashMap<ClassLoader, ClassLoaderLogInfo>();
/**
* This prefix is used to allow using prefixes for the properties names
* of handlers and their subcomponents.
*/
- protected ThreadLocal prefix = new ThreadLocal();
+ protected ThreadLocal<String> prefix = new ThreadLocal<String>();
// --------------------------------------------------------- Public Methods
@@ -179,7 +180,7 @@
* Get an enumeration of the logger names currently defined in the
* classloader local configuration.
*/
- public synchronized Enumeration getLoggerNames() {
+ public synchronized Enumeration<String> getLoggerNames() {
ClassLoader classLoader = Thread.currentThread()
.getContextClassLoader();
return Collections.enumeration(getClassLoaderInfo(classLoader).loggers.keySet());
@@ -334,12 +335,12 @@
}
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 @@
protected static final class LogNode {
Logger logger;
- protected final Map children = new HashMap();
+ protected final Map<String, LogNode> children =
+ new HashMap<String, LogNode>();
protected final LogNode parent;
@@ -487,6 +489,9 @@
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 @@
protected static final class ClassLoaderLogInfo {
final LogNode rootNode;
- final Map loggers = new HashMap();
- final Map handlers = new HashMap();
+ final Map<String, Logger> loggers = new HashMap<String, Logger>();
+ final Map<String, Handler> handlers = new HashMap<String, Handler>();
final Properties props = new Properties();
ClassLoaderLogInfo(final LogNode rootNode) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org