This page last changed on Jul 09, 2008 by ritchiem.
How to configure the CompositeRolling log4j Appender
There are several sections of our default log4j file that will need your attention if you wish to fully use this Appender.
1 Enable the Appender
The default log4j.xml file uses the FileAppender, swapp this for the ArchivingFileAppender as follows:
2 Configure the Appender
The Appender has a number of parameters that can be adjusted depending on what you are trying to achieve. For clarity lets take a quick look at the complete default appender:
The appender configuration has three groups of parameter configuration.
The first group is for configuration of the file name. The default is to write a log file to QPID_WORK/log/qpid.log (Remembering you can use the logprefix and logsuffix values to modify the file name, see [Property Config]).
The second section allows the specification of a Maximum File Size and a DatePattern that will be used to move on to the next file.
When MaxFileSize is reached a new log file will be created
The DataPattern is used to decide when to create a new log file, so here a new file will be created for every minute and every 10Meg of data. So if 15MB of data is made every minute then there will be two log files created each minute. One at the start of the minute and a second when the file hit 10MB. When the next minute arrives a new file will be made even though it only has 5MB of content. For a production system it would be expected to be changed to something like 'yyyy-MM-dd' which would make a new log file each day and keep the files to a max of 10MB.
The final MaxSizeRollBackups allows you to limit the amount of disk you are using by only keeping the last n backups.
The final section allows the old log files to be compressed and copied to a new location.
|