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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

284 views 3 11
Read article

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