你能让Tomcat 6 stdout.log文件表现得像log4j DailyRollingFileAppender吗? [英] Can you make the Tomcat 6 stdout.log file behave like a log4j DailyRollingFileAppender?

查看:186
本文介绍了你能让Tomcat 6 stdout.log文件表现得像log4j DailyRollingFileAppender吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Tomcat 6的Windows安装。默认情况下,我们应用程序的log4j输出转到$ {catalina.base} /logs/stdout_.log文件。此日志文件仅在我们重新启动Tomcat时翻转,文件名始终包含日期。

We are using the Windows installation of Tomcat 6. By default, the log4j output for our app goes to the ${catalina.base}/logs/stdout_.log file. This log file only rolls over when we restart Tomcat, and the file name always includes the date.

我希望它的行为类似于DailyRollingFileAppender,它重命名文件当它滚动...这样我就可以打开Notepad ++并查看今天的日志,因为Notepad ++会记住我昨天打开了同一个文件。 :)

I would prefer it to behave like a DailyRollingFileAppender, where it renames the file when it rolls over... that way I can just open Notepad++ and see today's logs, since Notepad++ will remember that I opened that same file yesterday. :)

我知道我可以在log4j中创建另一个appender,但我最终会得到stdout.log和另一个日志文件,我担心会有记录到两个文件是一个小的性能影响。我已经尝试将swallowOutput = true添加到我的context.xml中,但我仍然记录了stdout.log中的所有日志。有什么想法?

I know I can just create another appender in log4j, but I would end up with the stdout.log and another log file, and I'm afraid there would be a minor performance hit for logging to both files. I've tried adding swallowOutput=true to my context.xml but I still get all logging in stdout.log. Any ideas?

推荐答案

您是否尝试过登录Tomcat ?如果您按照以下步骤操作,最终会在lib目录中找到log4j.properties,您可以根据自己的内容进行自定义。

Have you tried the steps outlined in Logging in Tomcat? If you follow the steps you'll end up with log4j.properties in the lib directory that you can customize to your heart's content.

这篇关于你能让Tomcat 6 stdout.log文件表现得像log4j DailyRollingFileAppender吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆