Author: schultz
Date: Mon Sep 16 14:31:01 2013
New Revision: 1523674

URL: http://svn.apache.org/r1523674
Log:
Added logging of logging.properties location when system property is set.

Modified:
    tomcat/trunk/java/org/apache/juli/ClassLoaderLogManager.java

Modified: tomcat/trunk/java/org/apache/juli/ClassLoaderLogManager.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/juli/ClassLoaderLogManager.java?rev=1523674&r1=1523673&r2=1523674&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/juli/ClassLoaderLogManager.java (original)
+++ tomcat/trunk/java/org/apache/juli/ClassLoaderLogManager.java Mon Sep 16 
14:31:01 2013
@@ -22,6 +22,7 @@ import java.io.FileInputStream;
 import java.io.FilePermission;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URL;
 import java.net.URLClassLoader;
 import java.security.AccessControlException;
 import java.security.AccessController;
@@ -43,8 +44,13 @@ import java.util.logging.Logger;
 
 /**
  * Per classloader LogManager implementation.
+ *
+ * For light debugging, set the system property
+ * <code>org.apache.juli.ClassLoaderLogManager.debug=true</code>.
+ * Short configuration information will be sent to <code>System.err</code>.
  */
 public class ClassLoaderLogManager extends LogManager {
+    public static final String DEBUG_PROPERTY = LogManager.class.getName() + 
".debug";
 
     private final class Cleaner extends Thread {
 
@@ -414,9 +420,22 @@ public class ClassLoaderLogManager exten
         // Special case for URL classloaders which are used in containers:
         // only look in the local repositories to avoid redefining loggers 20 
times
         try {
-            if ((classLoader instanceof URLClassLoader)
-                    && (((URLClassLoader) 
classLoader).findResource("logging.properties") != null)) {
-                is = classLoader.getResourceAsStream("logging.properties");
+            if (classLoader instanceof URLClassLoader)
+            {
+                URL logConfig = 
((URLClassLoader)classLoader).findResource("logging.properties");
+
+                if(null != logConfig)
+                {
+                    if(Boolean.getBoolean(DEBUG_PROPERTY))
+                        System.err.println("Found logging.properties at " + 
logConfig);
+
+                    is = classLoader.getResourceAsStream("logging.properties");
+                }
+                else
+                {
+                    if(Boolean.getBoolean(DEBUG_PROPERTY))
+                        System.err.println("Found no logging.properties");
+                }
             }
         } catch (AccessControlException ace) {
             // No permission to configure logging in context



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to