Hi,

      JIRA has been running for a long period and it's great to experience such an uptime. One downside is that the catalina.out file grew to almost 300MB.

      How can we configure JIRA's logging system to rotate catalina.out file daily, as is done with other files (e.g. atlassian-jira.2005-12-19.log)

      Thanks,
      Guillaume.

      Workaround

      Options to rotate catalina.out and detailed steps for using logrotate are documented at How to Rotate the Catalina Log File

            [JRASERVER-8841] How to rotate Tomcat's catalina.out

            Since the log4j file in JIRA is configured to send lots of information to the console (which ends in stdout) the log file can get big, if there is a lot of information being logged.

            I am not aware of any way of stopping Tomcat behaving this way. My recommendation, then, is to update the log4j file to stop logging to stdout. If you take a look at the atlassian-jira\WEB-INF\classes\log4j.properties file, you will see that Jira defines a filelog appender, that rotates every 20M. In my system, it is configured like:

            log4j.appender.filelog=org.apache.log4j.RollingFileAppender
            log4j.appender.filelog.File=c:\\tmp\\atlassian-jira.log
            log4j.appender.filelog.MaxFileSize=20480KB
            ...
            

            You can configure Jira to use only the filelog appender, and not to use the console. To do that, you should update all logging levels. For example, for the com.atlassian package, you can update from:

            log4j.category.com.atlassian = WARN, console, filelog
            log4j.additivity.com.atlassian = false
            

            only to log to the filelog, and not to stdout:

            log4j.category.com.atlassian = WARN, filelog
            log4j.additivity.com.atlassian = false
            

            That will prevent the warnings in that package and its descendants to log into the stdout file. If you remove the 'console' form all packages, the file size should be significantly reduced. Once you have updated the log4j file, you will need to re-start Jira for the changes to take effect.

            I hope this helps.

            Bogdan Dziedzic [Atlassian] added a comment - Since the log4j file in JIRA is configured to send lots of information to the console (which ends in stdout) the log file can get big, if there is a lot of information being logged. I am not aware of any way of stopping Tomcat behaving this way. My recommendation, then, is to update the log4j file to stop logging to stdout. If you take a look at the atlassian-jira\WEB-INF\classes\log4j.properties file, you will see that Jira defines a filelog appender, that rotates every 20M. In my system, it is configured like: log4j.appender.filelog=org.apache.log4j.RollingFileAppender log4j.appender.filelog.File=c:\\tmp\\atlassian-jira.log log4j.appender.filelog.MaxFileSize=20480KB ... You can configure Jira to use only the filelog appender, and not to use the console. To do that, you should update all logging levels. For example, for the com.atlassian package, you can update from: log4j.category.com.atlassian = WARN, console, filelog log4j.additivity.com.atlassian = false only to log to the filelog, and not to stdout: log4j.category.com.atlassian = WARN, filelog log4j.additivity.com.atlassian = false That will prevent the warnings in that package and its descendants to log into the stdout file. If you remove the 'console' form all packages, the file size should be significantly reduced. Once you have updated the log4j file, you will need to re-start Jira for the changes to take effect. I hope this helps.

            Despite that Tomcat doesn't have a build-in mechanism that allows you to rotate catalina.out, there are third-party applications that can be used.

            In general words there are 4 options to rotate the log file:

            1. Configure log4j.properties to use a DailyRollingFileAppender.
            2. Use Apache's rotatelogs or cronolog - and take advantage of piped logs.
            3. Create Logrotate, shutdown service and archive the file.
            4. Rotate the file manually.

            Please note, you should refer to the online resources / documentation of a given application for examples and more info.

            Bogdan Dziedzic [Atlassian] added a comment - Despite that Tomcat doesn't have a build-in mechanism that allows you to rotate catalina.out , there are third-party applications that can be used. In general words there are 4 options to rotate the log file: Configure log4j.properties to use a DailyRollingFileAppender. Use Apache's rotatelogs or cronolog - and take advantage of piped logs. Create Logrotate , shutdown service and archive the file. Rotate the file manually. Please note, you should refer to the online resources / documentation of a given application for examples and more info.

            Guillaume,

            Per the Tomcate site, you cannot rotate catalina.out:

            http://tomcat.apache.org/faq/logging.html#catalina.out

            However, if you'd rather use atlassian-jira.log (which does rotate)
            exclusively you should make the following modifications to the
            log4j.properties file located in

            $JIRA_HOME/atlassian-jira/WEB-INF/classes

            (where $JIRA_HOME is your JIRA installation directory)

            Remove console from this line:

            log4j.rootLogger=WARN, console, errorlog, filelog

            Specify an absolute path for atlassian-jira.log:

            log4j.appender.filelog.File=$JIRA_HOME/logs/atlassian-jira.log

            This will cause JIRA to stop writing to catalina.out and only to
            atlassian-jira.log. atlassian-jira.log rolls based on a size of 20MB
            and keeps a total of 5 logs. Both of these options are modifiable in
            the log4j.properties file.

            Let me know how this works for you and if I can be of any further
            assistance.

            Thanks,
            Donna

            Donna McGahan added a comment - Guillaume, Per the Tomcate site, you cannot rotate catalina.out: http://tomcat.apache.org/faq/logging.html#catalina.out However, if you'd rather use atlassian-jira.log (which does rotate) exclusively you should make the following modifications to the log4j.properties file located in $JIRA_HOME/atlassian-jira/WEB-INF/classes (where $JIRA_HOME is your JIRA installation directory) Remove console from this line: log4j.rootLogger=WARN, console, errorlog, filelog Specify an absolute path for atlassian-jira.log: log4j.appender.filelog.File=$JIRA_HOME/logs/atlassian-jira.log This will cause JIRA to stop writing to catalina.out and only to atlassian-jira.log. atlassian-jira.log rolls based on a size of 20MB and keeps a total of 5 logs. Both of these options are modifiable in the log4j.properties file. Let me know how this works for you and if I can be of any further assistance. Thanks, Donna

              Unassigned Unassigned
              2306543e06a0 Guillaume Lahitette
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: