TOMCAT6 Logging using log4j

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.