You can customize your log4j formatted log files including
file location, size, and number of back up files.
Use the log formatting options to modify and manage your log4j
log files. To configure you log files you must edit the log.xml file
located in the $TOP/etc/default directory.
- Rolling File Appender parameters
- Location of the log file
- To change the location of a generated log file, change the File parameter
of the specified log configuration file.
- In this example, the file directory of the webserver_db.log is $TOP/logs.
<param name="File" value="$TOP/logs/webserver_db.log" />
- Maximum size of the log file
- The size of the log file can be set to a specified storage size
before it starts to rotate and purge the files. To control when the
file begins to truncate, change the maxFileSize parameter
value.
- In this example, the maximum file size is 10MB.
<param name="maxFileSize" value="10MB" />
- Maximum number of log files to keep
- The logger can be defined to keep a specified number of back ups
for a log file. Once the maximum number is reached, the oldest file
is deleted. To control the number of files you store, change the maxBackupIndex parameter
value.
- In this example, the maximum number of back up log files is 2.
<param name="maxBackupIndex" value="2" />