I'm using the Tomcat version: apache-tomcat-6.0.35
tomcat-6.0.35:https://archive.apache.org/dist/tomcat/tomcat-6/v6.0.35/bin/
Jar Package Required: Tomcat-juli-adapters.jar Log4j-1.2.15.jar Tomcat-juli.jar
Jar Package: https://archive.apache.org/dist/tomcat/tomcat-6/v6.0.14/bin/extras/
log4j configuration file Required: log4j.properties
Attached log4j.properties configuration file
# This is the configuring forlogging displayed in the application server# TRACE DEBUG INFO WARN error# default log level, output location log4j.rootcategory=DEBUG, Logfile,stdout#stdout configurelog4j.appender.stdout=org.apache.log4j.consoleappender# whether to print to the console #log4j.appender.stdout.target=System.errlog4j.appender.stdout.layout=Org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d%p [%c]-<%m>%n#logfile Configurelog4j.appender.logfile=Org.apache.log4j.DailyRollingFileAppender
#${catalina.home}:tomcat's Location Log4j.appender.logfile.File=${catalina.home}/logs/Tomcat.loglog4j.appender.logfile.layout=Org.apache.log4j.PatternLayoutlog4j.appender.logfile.layout.ConversionPattern=%d%p [%c]-<%m>%n
Operation Steps:
1. Copy the Tomcat-juli-adapters.jar, Log4j-1.2.15.jar, log4j.properties to the Tomcat/lib path.
2. Copy the Tomcat-juli.jar to the Tomcat/bin path.
3. Start Tomcat to verify if there are any logs generated under Tomcat/logs.
#日志级别不能太低, if configured for debug, there is too much log information for the output, which causes Tomcat to start very slowly.
Reference: http://618119.com/archives/2007/12/04/37.html
TOMCAT6 Logging using log4j