tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Bateman <bobbate...@sequoiallc.com>
Subject [Slightly OT] Catalina Policy and log4j
Date Wed, 06 Apr 2005 21:00:06 GMT
I'm transitioning a web site from 4.x over to 5.5.7.  Everything is
going well *except* for logging (a sore subject for me.)

I've created a small log4j.properties file and placed it in
${catalina.home}/common/classes.  The file contains:

#log4j.properties
log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/tomcat.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
#
log4j.logger.org.apache.catalina=DEBUG, R
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=DEBUG, R
log4j.logger.org.apache.catalina.core=DEBUG, R
log4j.logger.org.apache.catalina.session=DEBUG, R

I took all of the above *straight* from the documentation...  I placed
the commons-logging.jar (NOT the api.jar file) and log4j-1.2.9.jar into
${catalina.home}/common/lib.  Again - per the *excellent* documentation.


When I load TC with -Dlog4j.debug=true, log4j tells me it's finding a
log4j.properties file in the axis-ant.jar file in my CLASSPATH - NOT
perfect, but something...  When I load TC with -Dlog4j.debug=true AND
specify -security to cause Tomcat to use conf/catalina.policy - log4j no
longer locates a log4j.properties file.

*Knowing* that I *must* insure I give TC permission to locate and read
the log4j.properties file, I added the following line to catalina.policy

grant {
  permission java.io.FilePermission
    "file:${catalina.home}/common/classes/log4j.properties", "read";
}

Reloading TC with -Dlog4j.debug=true produces:

log4j: Trying to find [log4j.xml] using context classloader
sun.misc.Launcher$AppClassLoader@a39137.
log4j: Trying to find [log4j.xml] using
sun.misc.Launcher$AppClassLoader@a39137 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader
sun.misc.Launcher$AppClassLoader@a39137.
log4j: Trying to find [log4j.properties] using
sun.misc.Launcher$AppClassLoader@a39137 class loader.
log4j: Trying to find [log4j.properties] using
ClassLoader.getSystemResource().
log4j: Could not find resource: [null].


According to the log entries, TC can't see my properties file!  Any one
have a clue what I'm doing wrong???


Bob


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message