开发者

Configuring tomcat for internal log with log4j!

开发者 https://www.devze.com 2023-02-15 13:27 出处:网络
I am using apache-tomcat-6.0.18 and want to configure log4j for tomcat internal logging. I gone through the tomcat site Logging in Tomcat. But i didn\'t understood the STEP 3,4,5.

I am using apache-tomcat-6.0.18 and want to configure log4j for tomcat internal logging.

I gone through the tomcat site Logging in Tomcat. But i didn't understood the STEP 3,4,5.

What is the extras components? How can these be helpful for Logging?

If someone can guide me Step By Step will really help !!!

开发者_如何转开发Please guide me on this?


If you don't need to build Tomcat from source then get the tomcat-juli.jar and tomcat-juli-adapters.jar from this location: http://mirrors.enquira.co.uk/apache/tomcat/tomcat-6/v6.0.32/bin/extras/

and replace the .jar files as per the instructions.

$CATALINA_HOME is where your Tomcat 6.0 is installed.

Hope this helps.


@Thanks DaveRead, I got my problem resolved, I just made some changes in log4j.properties file and its working. Here is entry.

....
....

#Roll-over the log once per day
log4j.appender.CATALINA.DatePattern='.'yyyy-MM-dd'.log' log4j.appender.CATALINA.layout.ConversionPattern = %d [%t] %-5p %c- %m%n log4j.appender.CATALINA.layout=org.apache.log4j.PatternLayout
log4j.appender.CATALINA.append=true

log4j.appender.LOCALHOST=org.apache.log4j.DailyRollingFileAppender log4j.appender.LOCALHOST.file=${catalina.base}/logs/localhost.log log4j.appender.LOCALHOST.encoding=UTF-8
#Roll-over the log once per day log4j.appender.LOCALHOST.DatePattern='.'yyyy-MM-dd'.log' log4j.appender.LOCALHOST.layout.ConversionPattern = %d [%t] %-5p %c- %m%n log4j.appender.LOCALHOST.layout=org.apache.log4j.PatternLayout log4j.appender.LOCALHOST.append=true
...
...

0

精彩评论

暂无评论...
验证码 换一张
取 消