使用 log4j 配置 tomcat 进行内部日志!
我正在使用 apache-tomcat-6.0.18 并希望为 tomcat 内部日志记录配置 log4j。
我浏览了 tomcat 站点登录 Tomcat。但我不明白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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不需要从源代码构建 Tomcat,则从以下位置获取 tomcat-juli.jar 和 tomcat-juli-adapters.jar:
http://mirrors.enquira.co。 uk/apache/tomcat/tomcat-6/v6.0.32/bin/extras/
并按照说明替换 .jar 文件。
$CATALINA_HOME 是 Tomcat 6.0 的安装位置。
希望这有帮助。
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.
@谢谢 DaveRead
,我的问题得到了解决,我只是对 log4j.properties 文件及其工作进行了一些更改。这里是入口。<代码>....
....
#每天滚动日志一次
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
#每天滚动日志一次
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
<代码>...
<代码>...
@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
...
...