By default tomcat uses "java.util.logging" for all internal logging in tomcat. If you want to use log4j with tomcat for logging then follow below steps.
So before we start lets remove tomcat's default java.util.logging configuration and add log4j.
You will have to download log4j jar file from here. Apart from log4j jar file you need to get tomcat-juli.jar and tomcat-juli-adapters.jar files from this location according to your tomcat version.
So after downloading log4j jar, tomcat-juli.jar and tomcat-juli-adapters.jar files follow below steps.
1. Copy tomcat-juli-adapters.jar file into tomcat/lib folder.
2. Create log4j.properties file in tomcat/lib folder with below content.
3. Now copy downloaded tomcat-juli.jar into tomcat/bin directory. You need to replace existing tomcat-juli.jar file.
4. Then remove tomcat/conf/logging.properties file.
You will have to download log4j jar file from here. Apart from log4j jar file you need to get tomcat-juli.jar and tomcat-juli-adapters.jar files from this location according to your tomcat version.
So after downloading log4j jar, tomcat-juli.jar and tomcat-juli-adapters.jar files follow below steps.
1. Copy tomcat-juli-adapters.jar file into tomcat/lib folder.
2. Create log4j.properties file in tomcat/lib folder with below content.
3. Now copy downloaded tomcat-juli.jar into tomcat/bin directory. You need to replace existing tomcat-juli.jar file.
4. Then remove tomcat/conf/logging.properties file.
Nice Blog !!
ReplyDelete