1
votes

I wanted to configure log4j rollingFileAppender in alfresco 4.0.1 as I wanted to keep rotating catalina.out file whenever it's size reaches 10MB. So I configured log4j with tomcat using below link.

http://tomcat.apache.org/tomcat-6.0-doc/logging.html#Using_Log4j

To configure rollingFileAppender I have written below lines in tomcat/lib/log4j.properties file.

log4j.rootLogger=INFO, File

Console appender definition

log4j.appender.File=org.apache.log4j.RollingFileAppender log4j.appender.File.File=${catalina.base}/logs/catalina.out log4j.appender.File.MaxFileSize=10MB log4j.appender.File.Append=true log4j.appender.File.MaxBackupIndex=10 log4j.appender.File.layout=org.apache.log4j.PatternLayout

log4j.appender.File.layout.ConversionPattern=%d{ISO8601} [%x] [%p] [%c{3}] [%t] [%r] %m%n

log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INFO log4j.logger.org.apache.catalina.core=INFO log4j.logger.org.apache.catalina.session=INFO

When I start alfresco and monitors logs, I can see that when catalina.out file reaches 10MB log4j renames it to catalina.out.1 file and creates new catalina.out file. But the issue is, tocmat keeps logging in catalina.out.1 file. It should be writing to catalina.out file always, right?

How do I solve it??

1

1 Answers

2
votes

I tried a lot and then asked in Alfresco support. They have suggested to use linux's tool logrotate for log rotation. I have configured that and seems like rotation is working fine. My logrotate configuration is as below.

/path/to/log/file/catalina.out { 
copytruncate 
rotate 7 
compress 
missingok 
size 10M 
}

Hope this will help.