log4j,How to configure Log4j in Tomcat

Steps below explain how to configure Tomcat to use log4j system.
1. Download extra components including extras/tomcat-juli.jar, extras/tomcat-juli-adapters.jar in Apchee tomcat home page.
2. Replace $CATALINA_HOME/bin/tomcat-juli.jar with extras/tomcat-juli.jar just downloaded.
3. Place estras/tomcat-juli-adapters.jar in $CATALINA_HOME/lib.
4. Delete $CATALINA_HOME/conf/logging.properties file.
5. Writing log4j.properties file and put _disibledevent=>Download Log4J (v1.2 or later) and place the log4j jar in $CATALINA_HOME/lib.
7. Web applications should certainly use their own log4j configuration. Please place your log4j.properties file in your web application’s WEB-INF/classes, and log.xx.jar into WEB-INF/lib.
Henceforth, you do not write any source code regarding the log4j, but the log4j.properties. Tomcat will load all the things with the Applications starting up.
Tags:  log4j配置 log4j

延伸阅读

最新评论

发表评论