Support Article
Unable to Roll over the Log Using "RollingFileAppender"
SA-5993
Summary
What is the prlogging.xml configuration to roll the log file based on size?
Upon changing the appender class to RollingFileAppender, the following error message was seen in the log
log4j:WARN No such property [fileNamePattern] in com.pega.apache.log4j.RollingFileAppender.
There has also been a requirement to roll the log file based on both size and date, for example:
PegaRULES.log
PegaRULES.log.2015-01-15.1
PegaRULES.log.2015-01-15.2
PegaRULES.log.2015-01-14.1
PegaRULES.log.2015-01-14.2
Resolution
This issue is resolved through the following local change:
RollingFileAppender has a different set of attributes required. These includes maxFileSize and MaxBackupIndex. And the file name should not have date time pattern. Here's how it should look like.
<appender name="PEGA" class="com.pega.apache.log4j.RollingFileAppender">
<param name="File" value="@{web.tmpdir}/PegaRULES.log"/>
<param name="maxFileSize" value="1MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="com.pega.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%20.20t] [%10.10X{pegathread}] [%20.20X{tenantid}] [%20.20X{app}] (%30.30c{3}) %-5p %X{stack} %X{userid} - %m%n"/>
</layout>
</appender>
To roll the log file based on both size and date, you will need to write up a custom log appender. This is not a supported feature in Pega.
Published January 31, 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.