catalina.out 随 Tomcat 6.0 一起推出

发布于 2024-07-26 21:34:51 字数 481 浏览 9 评论 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

烦人精 2024-08-02 21:34:51

修复了它,事实证明标准日志记录配置定义了文件记录器和控制台记录器。 文件记录器转到每日 catalina 日志,控制台记录器写入 catalina.out。

修复方法是在 conf/logging.properties 中进行更改:

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler

这会阻止将任何内容写入 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:

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

to

.handlers = 1catalina.org.apache.juli.FileHandler

That stops anything getting written to catalina.out

〃温暖了心ぐ 2024-08-02 21:34:51

您好,您可能想尝试这个解决方案

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.

沙沙粒小 2024-08-02 21:34:51

您可以通过配置轮换 catalina.out 文件:-

步骤:-

  • 1) 转到 /etc/logrotate.d 并创建文件 tomcat

  • < p>2) 粘贴到行下方

  • 按大小旋转

/opt/OS/OS2/logs/catalina.out {
复制截断
每日
旋转30
压缩
失踪了
尺寸20M
}

-- size - 备份 catelina.out 如果大小大于 20MB

  • 旋转

/opt/deadpool/apache-tomcat/logs/catalina.out {

copytruncate

dateext

dailyrotate

30

compressmissingok

}

按日期

  • rotate - 保存最后 30 个旋转
  • dateext -每天备份 catelina.out
  • - 每日轮换
  • 压缩 - 以压缩形式轮换
  • Missok - 如果轮换中缺少某些内容,不会造成影响

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

  • Rotate by Date

/opt/deadpool/apache-tomcat/logs/catalina.out {

copytruncate

dateext

daily

rotate 30

compress

missingok

}

  • rotate - Save last 30 rotation
  • dateext - backup catelina.out everyday
  • daily - Rotation daily basis
  • compress - rotation in compress form
  • missingok - if something is missing in rotation it will create no impect

3) Restart the server

Its work for me :)
Hope this will help someone.

Thank you :)

涫野音 2024-08-02 21:34:51

我在 Ubuntu 11.04 SOLR 服务器上遇到了同样的问题,catalina.out 文件几乎有 1GB。 后

更改logging.properties

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler

停止记录到 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:

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

to

.handlers = 1catalina.org.apache.juli.FileHandler

That stops logging to catalina.out

You can find logging.properties file on /etc/tomcat6/ folder for Ubuntu Linux.

别理我 2024-08-02 21:34:51

我还注意到我的 tomcat 日志文件夹 (/usr/local/tomcat/logs) 非常大。 要检查日志文件夹的大小,请执行以下 du -hs /usr/local/tomcat/logs/。 要解决此问题,可以设置一个每晚清理文件的 cron,或者您可以手动运行这些命令。 这是删除 5 天前的文件的 shell 脚本

#!/bin/sh
find /usr/local/tomcat/logs -name 'catalina.*.log' -mtime +5 -print0 | xargs -0 rm -f
find /usr/local/tomcat/logs -name 'localhost_access_log.*.txt' -mtime +5 -print0 | xargs -0 rm -f

I also noticed my tomcat log folder (/usr/local/tomcat/logs) was quite huge. To check the size of the log folder do the following du -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

#!/bin/sh
find /usr/local/tomcat/logs -name 'catalina.*.log' -mtime +5 -print0 | xargs -0 rm -f
find /usr/local/tomcat/logs -name 'localhost_access_log.*.txt' -mtime +5 -print0 | xargs -0 rm -f
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文