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 vote
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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

795 views 2 19
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