2013/9/16 <[email protected]>: > Author: schultz > Date: Mon Sep 16 14:49:26 2013 > New Revision: 1523685 > > URL: http://svn.apache.org/r1523685 > Log: > Added logging of logging.properties location when system property is set. > > Modified: > tomcat/tc7.0.x/trunk/ (props changed) > tomcat/tc7.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java > tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml >
1. Code style. 2. Both branches of 'if' have duplicate code that reads the property. It could be moved up a bit. (I am OK with re-reading the property on each invocation of this method, as I think one can change it at runtime, or may configure it in catalina.properties) 3. You have to update catalina.policy. Otherwise it will fail when running with a SecurityManager. (The "bin/tomcat-juli.jar" file has some specific set of permissions, unlike the rest of Tomcat jars. It does not have AllPermission.). Best regards, Konstantin Kolinko > Propchange: tomcat/tc7.0.x/trunk/ > ------------------------------------------------------------------------------ > Merged /tomcat/trunk:r1523674 > > Modified: tomcat/tc7.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java > URL: > http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java?rev=1523685&r1=1523684&r2=1523685&view=diff > ============================================================================== > --- tomcat/tc7.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java > (original) > +++ tomcat/tc7.0.x/trunk/java/org/apache/juli/ClassLoaderLogManager.java Mon > Sep 16 14:49:26 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 { > > @@ -415,9 +421,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 > > Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml > URL: > http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1523685&r1=1523684&r2=1523685&view=diff > ============================================================================== > --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) > +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Sep 16 14:49:26 2013 > @@ -170,6 +170,11 @@ > The loaded attribute never exists in <code>PersistentManager</code>. > isLoaded is defined as operation in mbeans-descriptors. (kfujino) > </fix> > + <add> > + Added logging of logging.properties location when system property > + > <code></code>org.apache.juli.ClassLoaderLogManager.debug=true</code> > + is set. > + </add> > </changelog> > </subsection> > <subsection name="Coyote"> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
