Support Article
DailyRollingFileAppender_Not working for CMG Logging
Summary
User wants to create the new daily rolling pattern.
Configuration in prlogging.xml with DailyRollingFileAppender is not generating backup log files correctly.
Below is the configuration details:
<appender class="com.pega.apache.log4j.DailyRollingFileAppender" name="PEGA">
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<param name="File" value="'/yourpath/PegaRULES.log'"/>
<layout class="com.pega.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%p] [%d{yyyy/MM/dd HH:mm:ss,SSS}] [%t] [%X{tenantid}] [%X{app}] [%c{3}] [%X{stack}] [%X{userid}] [%m]%n"/>
</layout>
</appender>
Error Messages
Not Applicable
Steps to Reproduce
1.Open prlogging.xml
2. Edit the appender name with "PEGA" as below:
<appender class="com.pega.apache.log4j.DailyRollingFileAppender" name="PEGA">
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<param name="File" value="'/yourpath/PegaRULES.log'"/>
<layout class="com.pega.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%p] [%d{yyyy/MM/dd HH:mm:ss,SSS}] [%t] [%X{tenantid}] [%X{app}] [%c{3}] [%X{stack}] [%X{userid}] [%m]%n"/>
</layout>
</appender>
Root Cause
A software use or operation error : User configuration fault.
Resolution
Perform the following local-change:
The single quotes (') characters in the param "File" is causing the behavior.
Change the configuration as mentioned below to resolve the issue:
<appender class="com.pega.apache.log4j.DailyRollingFileAppender" name="PEGA">
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<param name="File" value="/yourpath/PegaRULES.log"/>
<layout class="com.pega.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%p] [%d{yyyy/MM/dd HH:mm:ss,SSS}] [%t] [%X{tenantid}] [%X{app}] [%c{3}] [%X{stack}] [%X{userid}] [%m]%n"/>
</layout>
</appender>
After implementing the above configuration, the logs get rolled out as expected for the date change.
Old log files got appended with date and new logs will be stored into PegaRules-.log file. Below is the screen print of logs folder.
Published September 20, 2017 - 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.