Catalina Logs are not Rotated or Removed

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

症状

  1. catalina.out is not rotated
  2. old catalina.*.log files are not removed

These log files can grow large in size.

原因

Confluence uses Tomcat's default logging configuration. This configuration means:

  • catalina.out gets all output from stdout and stderr via ConsoleHandler, and also logs from bootstrap step when you start or stop Confluence
  • catalina.out is never rotated
  • catalina.YYYY-MM-DD.log contains the output from stdout and stderr via FileHandler, but not the bootstrap logs
  • catalina.YYYY-MM-DD.log files are created on the first log event of that date, or when the Tomcat server starts. This means that if there is no log for that date, and the server was not started on that date, then the file is never created.
  • catalina.YYYY-MM-DD.log and catalina.out files are not removed
  • localhost, manager and host-manager logs are configured similarly to catalina.YYYY-MM-DD.log files 

ソリューション

  1. Reduce the amount logged to catalina.out, by disabling the ConsoleHandler. This is done by modifying the conf/logging.properties file. Find the line that looks like this:

    conf/logging.properties
    .handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler

    Change it to look like this:

    conf/logging.properties
    .handlers = 1catalina.org.apache.juli.AsyncFileHandler

    This will reduce the amount of logging to catalina.out, and does not lose any logging, since all of this output is already being put into the *.log files.

  2. Set up a scheduled job, using cron or some alternative, which removes old log files. For example to remove all the files older than one week, a script like this should do the job:

    sample_catalina_log_clean.sh
    #!/bin/sh
    find $CONFLUENCE_INSTALL/logs -name 'catalina.*.log' -mtime +1w -print0 | xargs -0 rm -f

    Remember to replace $CONFLUENCE_INSTALL with your actual Confluence install path, and to test your script on sample data to make sure you don't accidentally delete any logs that you want to keep.


The script above is just a suggestion. It's possible to use some other removal or archiving method if desired.

最終更新日 2021 年 11 月 29 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.