cancel
Showing results for 
Search instead for 
Did you mean: 

How to better configure log rotation in Alfresco?

brgsousa
Champ in-the-making
Champ in-the-making
I have a big problem with files generated in alfresco (alfresco.log, share.log and solr.log) and tomcat (tomcat/logs/*). They seem to grow and rotate indefinitely and I don't know where rotation parameters are configured. I wish to use system's logrotate (example: /etc/logrotate.d/alfresco) but I think it will conflict with the existing default rotation of those files.

How can I configure log rotation defining max number of files and compression?
2 REPLIES 2

abarisone
Star Contributor
Star Contributor
Hi,
since Alfresco uses log4j for logging, you have some choices.
This solution gives you the opportunity to limit the file size and to decide the number of backup files.

log4j.appender.R.MaxFileSize=100KB
# Keep one backup file

log4j.appender.R.MaxBackupIndex=1

Personally I prefer the DailyRollingFileAppender that rolls each day on a new file

# LOG4J daily rolling log files configuration
log4j.rootLogger=DEBUG, RollingAppender

log4j.appender.RollingAppender=org.apache.log4j.DailyRollingFileAppender

log4j.appender.RollingAppender.File=app.log

log4j.appender.RollingAppender.DatePattern='.'yyyy-MM-dd

log4j.appender.RollingAppender.layout=org.apache.log4j.PatternLayout

log4j.appender.RollingAppender.layout.ConversionPattern=[%p] %d %c %M - %m%n

You can chack log4j page for more info at http://logging.apache.org/
If you need to modify Tomcat's log you need to refer to Tomcat Juli, which performs all logging operations.

Regards,
Andrea

davidbalt
Champ in-the-making
Champ in-the-making
Thanks for the information, but which of the 4 log4j.properties files is the most important one to update?

I've updated:
./tomcat/webapps/share/WEB-INF/classes/log4j.properties
./tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties
./solr4/log4j-solr.properties

With:

log4j.appender.File.MaxFileSize=1000KB
log4j.appender.File.MaxBackupIndex=5

Is that sufficient to stop the infinitely growing log files I have?