tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fredk2 <fre...@gmail.com>
Subject Tomcat 6 and log4j for a web application
Date Fri, 24 Aug 2007 21:07:05 GMT

Hi,

still reading :-)  http://tomcat.apache.org/tomcat-6.0-doc/logging.html

I have setup log4j as above, but with a little twist.
If you permission $CATALINA_HOME as read only and you want to customize the
log4j.properties then you need to install the log4j1.2.14.jar and
log4j.properties in $CATALINA_BASE/lib.
You also need to adjust the catalina.properties common.loader 

common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar

The tomcat logging works well. However, I have 2 questions related to
installing log4j for a web application:

1.  why does the documentation say to add log4j1.2.x.jar to the WEB-INF/lib, 
isn't it already loaded by the common.loader at this point?

2.  is there a way to add a WEB-INF/classes/log4j.properties to log to
myapp1.log and capture all the logs related to the web application ?  Why
would'nt the following create a myapp1.log?

<myapp1>/WEB-INF/classes/log4j.properties ->

log4j.debug=TRUE
log4j.rootLogger=DEBUG,myapp1

# test logger
log4j.logger.org.apache=DEBUG,myapp1

# Log rotation
log4j.appender.myapp1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.myapp1.File=${catalina.base}/logs/myapp1.log
log4j.appender.myapp1.DatePattern='.'yyyy-MM-dd
# Print the date in ISO 8601 format
log4j.appender.myapp1.layout=org.apache.log4j.PatternLayout
log4j.appender.myapp1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n


Any hints - suggestions are appreciated,
Many Thanks - Fred
-- 
View this message in context: http://www.nabble.com/Tomcat-6-and-log4j-for-a-web-application-tf4325752.html#a12319790
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message