catalina.out 随 Tomcat 6.0 一起推出
我有一个默认的 tomcat 安装,没有更改日志配置。 日志文件(特别是 catalina.out)似乎正在正确滚动(每天)。
然而,除了每日日志之外,还有一个 catalina.out 文件,该文件还在不断增长。 这就是我需要解决的问题,即每天清除它(或者如果可能的话将其完全删除)
有人可以解释这里发生了什么以及控制日志文件大小的最佳策略吗?
只是为了澄清输出正在同时写入 catalina.out 和每日日志
-rw-r--r-- 1 solr solr 90920663 Jul 18 01:16 logs/catalina.2009-07-18.log
-rw-r--r-- 1 solr solr 238010 Jul 18 01:16 logs/catalina.out
设置吞噬输出似乎没有任何区别。
如果相关的话,在 tomcat 下运行的应用程序是 solr。
I have a default tomcat installation with no change to the logging configuration. The log files (in particular catalina.out) appear to be getting rolled (daily) correctly.
However as well as the daily logs there is also a catalina.out file, which just continues to grow. This is what I need to fix, ie have it cleared daily (or remove it altogether if possible)
Can someone explain what is going on here and the best best strategy for controlling that log file size?
Just to clarify the output is being written to catalina.out and the daily log simultaneously
-rw-r--r-- 1 solr solr 90920663 Jul 18 01:16 logs/catalina.2009-07-18.log
-rw-r--r-- 1 solr solr 238010 Jul 18 01:16 logs/catalina.out
Setting swallowOutput appears to not make any difference.
The application being run under tomcat is solr in case that is relevant.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
修复了它,事实证明标准日志记录配置定义了文件记录器和控制台记录器。 文件记录器转到每日 catalina 日志,控制台记录器写入 catalina.out。
修复方法是在 conf/logging.properties 中进行更改:
到
这会阻止将任何内容写入 catalina.out
Fixed it, turns out the standard logging configuration defines a file logger and also a console logger. The file logger goes to the daily catalina log, and the console logger writes to catalina.out.
Fix was to change in conf/logging.properties:
to
That stops anything getting written to catalina.out
您好,您可能想尝试这个解决方案
http://java.dzone.com/articles /how-rotate-tomcat-catalinaout
它使用 cronjob (logrotate) 来复制、压缩和清理 catalina.out,如果您查看 logrotate,您会发现它有很多附加功能。 它不会干扰每日日志,除非您配置它这样做。 当我遇到同样的问题时,我发现它很有帮助。
顺便说一句,删除控制台处理程序只会影响 Tomcat 生成的消息。
Hi you may want to try this solution
http://java.dzone.com/articles/how-rotate-tomcat-catalinaout
It uses a cronjob (logrotate) to copy, compress and clean your catalina.out and if you have a look at logrotate you will see it has a lot of additional functionality. It does not interfere with the daily logs, unless you configure it do so. I found it helpful when I was confronted with the same problem.
BTW removing the console handler will only affect messages produced by Tomcat.
您可以通过配置轮换 catalina.out 文件:-
步骤:-
1) 转到 /etc/logrotate.d 并创建文件 tomcat
按大小旋转
/opt/OS/OS2/logs/catalina.out {
复制截断
每日
旋转30
压缩
失踪了
尺寸20M
}
-- size - 备份 catelina.out 如果大小大于 20MB
或
/opt/deadpool/apache-tomcat/logs/catalina.out {
copytruncate
dateext
dailyrotate
30
compressmissingok
}
按日期
3)重新启动服务器
它对我有用:)
希望这会对某人有所帮助。
谢谢 :)
you can rotate the your catalina.out file by configure :-
Steps:-
1) Goto /etc/logrotate.d and Create file tomcat
2) Paste below line
Rotate by size
/opt/OS/OS2/logs/catalina.out {
copytruncate
daily
rotate 30
compress
missingok
size 20M
}
-- size - backup catelina.out if size is greater then 20MB
OR
/opt/deadpool/apache-tomcat/logs/catalina.out {
copytruncate
dateext
daily
rotate 30
compress
missingok
}
3) Restart the server
Its work for me :)
Hope this will help someone.
Thank you :)
我在 Ubuntu 11.04 SOLR 服务器上遇到了同样的问题,catalina.out 文件几乎有 1GB。 后
更改logging.properties
到
停止记录到 catalina.out
您可以在 Ubuntu Linux 的 /etc/tomcat6/ 文件夹中找到 logging.properties 文件。
I had same problem on Ubuntu 11.04 SOLR server and catalina.out file was almost 1GB. After
changing logging.properties:
to
That stops logging to catalina.out
You can find logging.properties file on /etc/tomcat6/ folder for Ubuntu Linux.
我还注意到我的 tomcat 日志文件夹 (
/usr/local/tomcat/logs
) 非常大。 要检查日志文件夹的大小,请执行以下du -hs /usr/local/tomcat/logs/
。 要解决此问题,可以设置一个每晚清理文件的 cron,或者您可以手动运行这些命令。 这是删除 5 天前的文件的 shell 脚本I also noticed my tomcat log folder (
/usr/local/tomcat/logs
) was quite huge. To check the size of the log folder do the followingdu -hs /usr/local/tomcat/logs/
. To resolved this issue by setting up a cron that would clean the files every night or you can run these commands manually. Here is the shell script that would delete files which are 5 days older