catalina.out rolling with Tomcat 6.0

后端 未结 5 2123
囚心锁ツ
囚心锁ツ 2020-12-01 00:16

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.

相关标签:
5条回答
  • 2020-12-01 00:38

    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

    0 讨论(0)
  • 2020-12-01 00:41

    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.

    0 讨论(0)
  • 2020-12-01 00:54

    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.

    0 讨论(0)
  • 2020-12-01 00:57

    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 :)

    0 讨论(0)
  • 2020-12-01 00:58

    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
    
    0 讨论(0)
提交回复
热议问题