Rotate catalina.out log

Hello

I am trying to configure log4j.properties to rotate catalina.out log using DailyRollingFileAppender or RollingFileAppender, however I am not able to achieve such configuration.

I tried following:

1) DailyRollingFileAppender

"tomlog" in rootLogger definition

log4j.rootLogger=WARN, console, filelog, tomlog

Then parameters to rotate each minute as an example

# DailyRollingFileAppender. Rotate catalina.out log
#####################################################
log4j.appender.tomlog = org.apache.log4j.DailyRollingFileAppender
log4j.appender.tomlog.File = /opt/atlassian/jira/logs/catalina.out
log4j.appender.tomlog.Append = true
log4j.appender.tomlog.Encoding = UTF-8
log4j.appender.tomlog.DatePattern = '.'yyyy-MM-dd-HH-mm'.test.log'
log4j.appender.tomlog.layout = org.apache.log4j.PatternLayout
log4j.appender.tomlog.layout.ConversionPattern = %d [%t] %-5p %c- %m%

However after Jira restart I see that Jira creates some files but the latest entries was recorded in "catalina.out.2015-05-27-10-59.test.log", not in catalina.out

catalina.out.2015-05-27-10-59.test.log
catalina.out.2015-05-27-11-22.test.log
catalina.out.2015-05-27-11-04.test.log
catalina.out.2015-05-27-11-01.test.log
catalina.out.2015-05-27-11-00.test.log

 

2) RollingFileAppender

"tomlog" in rootLogger definition

log4j.rootLogger=WARN, console, filelog, tomlog

Parameters to keep 100KB size of catalina.out and remove previous catalina logs except last 10 files

log4j.appender.tomlog=org.apache.log4j.RollingFileAppender
log4j.appender.tomlog.File=/opt/atlassian/jira/logs/catalina.out
log4j.appender.tomlog.MaxFileSize=100KB
log4j.appender.tomlog.MaxBackupIndex=10
log4j.appender.tomlog.layout=org.apache.log4j.PatternLayout
log4j.appender.tomlog.layout.ConversionPattern=%p %t %c - %m%n

This configuration doesn't work also- catalina.out grows more then 100KB

 

Could help me to configure catalina.out log file rotation?

 

Thanks,

Fyodor

 

 

1 answer

This widget could not be displayed.
Timothy Chin Community Champion Jun 01, 2015

Are you on a Linux box? Something like logrotate is better I suppose:

 

Hello Thanks for article, but is there possibility configure log4j for this? regards, Fyodor

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

167 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you