Support Article
How to roll PegaRULES log based on size
SA-2370
Summary
How can PegaRULES.log be rolled based on its size?
Resolution
The following configuration will roll logs based on size, generating log files PegaRULES.log, PegaRULES.log.1, PegaRULES.log.2, and so on:
<appender name="PEGA" class="com.pega.apache.log4j.RollingFileAppender">
<param name="File" value="'PegaRULES.log'"/>
<param name="MaxFileSize" value="10KB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="com.pega.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} [%20.20t](%30.30c{3}) %-5p %X{stack} %X{userid} - %m%n"/>
</layout>
</appender>
The log file with no number will contain the latest log entries. As the number increases, the older the log entries will be. In the example above, the oldest entries will be in, "PegaRULES.log.10" once enough log files have been created to reach the tenth file.
The value of MaxFileSize can be changed to suit the requirement (100KB, 10MB, and so on). This will only create logs until the MaxBackupIndex value is reached. Once this is reached, the oldest entries will be lost.
Published November 22, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.