if you want to use log4j in your application only,
then forget everything you read on logging.html

all you need to do is log4j.jar in WEB-INF/lib
log4j.properties in WEB-INF/classes

the steps you are outlining, are converting tomcat from using java.util.logging to log4j for the container. and you don't need those steps if all you want is log4j for a webapp

Filip

fredk2 wrote:
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


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

Reply via email to