You must customize the appender section of the log4j.xml file depending on your requirement, based on the parameters in the log4j file.
Follow these steps:
<appender name="memory" class="com.ca.usm.util.log.MemoryAppender">
<param name="File" value="${usm.home}/logs/error.log" />
<param name="MaxFileSize" value="10MB" />
<param name="MaxBackupIndex" value="10" />
<param name="MaxMemoryLogs" value="50000" />
<param name="MaxMemoryTime" value="600000" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy/MM/dd HH.mm.ss.SSS} %-5p [%X{UNIQUEID}] [%t] [%c{1}] %m%n" />
</layout>
</appender>
You can customize the following parameters in appender section:
Defines the path of the file where the in-memory logs are logged in case of an error. The default is error.log
Default: <param name="File" value="${usm.home}/logs/error.log" />
Defines the maximum size of the log file. Once the log file reaches the maximum size, the backup of the current log file is taken.
Default: <param name="MaxFileSize" value="10MB" />
Defines the maximum number of backup files to be restored on the system.
Default: <param name="MaxBackupIndex" value="10" />
Defines the maximum count of logs in the memory, after which the appender either recycles the logs in memory, or moves them to temporary files on disk.
The following actions are performed on the temporary files:
The optimal value is tested to be 50000.
Default: <param name="MaxMemoryLogs" value="50000" />
Defines the maximum time in milliseconds for the logs that remain in memory. If the logs remain in memory for MaxMemoryTime, they are discarded. The optimal value is tested to be 600000 milliseconds.
Default: <param name="MaxMemoryTime" value="600000" />
Defines the log statements that are logged based on the pattern provided. For more details on the ConversionPattern, please refer to Apache log4j documentation.
The {UNIQUEID} helps to identify the complete request from the beginning till the end of the request.
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy/MM/dd HH.mm.ss.SSS} %-5p [%X{UNIQUEID}] [%t] [%c{1}] %m%n" />
</layout>
Important! Do not update the logger name parameter of the logger section in the log4j.xml configuration file.
You have customized the configuration file.
|
Copyright © 2013 CA.
All rights reserved.
|
|