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

0 votes
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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,076 views 13 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot