Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Logging behaviour is different between prlogging and prlog4j



Post upgrade to Pega 7.3.1, the new prlog4j2.xml prevents the creation of the current log file with the current date.

In Pega 7.1.8, log file can be defined with the date and saved. When the system is rolled over, a new file is created with the current date and it can be the current log file.

When creating the log filename without a date, the rollover for filename occurs correctly. However, the log management using Splunk does not work.

Error Messages

Not Applicable

Steps to Reproduce

  1. Update from Pega 7.1.8 to Pega 7.3.1.
  2. Add a filename in the appender, such as fileName="${sys:pega.logdir}/PegaRULES-${date:MM-dd-yyyy}.log".

This creates the log file during the initial start up. However, after rollover, two files are named as: 

  • PegaRULES-08-15-2018.log
  • PegaRULES-08-15-2018-1.log

The actual date is retained and 1 is added at the end.

Root Cause

Log4j2 does prevents the addition of a date to the filename for RollingRandomAccessFile appender. Adding a date, causes the rolling behavior to not use the date.


Here's the explanation for the reported behavior:

In the earlier log4j implementation, used in the earlier Pega applications, appenders are declared as below:

    <appender name="PEGA" class="com.pega.pegarules.priv.util.DailySizeRollingFileAppenderPega">
      <param name="FileNamePattern" value="'C:/PRPC/PRPCLogs/719/PegaRULES-'yyyy-MMM-dd'.log'"/>
      <param name="MaxFileSize" value="50MB" />
      <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"/>

Only a FileNamePattern parameter is used to accept a filename and specify a date as above.
As a result, when the server is started, a log file is created using the above example with the "PegaRULES-2018-Aug-20.log" current date.
At midnight, the system creates "PegaRULES-2018-Aug-21.log" which is a new log file. All the current log items enter this new file.

In log4j2, this works differently. The file appender and has two parameters (fileName and filePattern) instead of one as in the older version.

For example,

        <RollingRandomAccessFile  name="PEGA" fileName="${sys:pega.logdir}/PegaRULES.log" filePattern="${sys:pega.logdir}/PegaRULES-%d{MM-dd-yyyy}-%i.log.gz">
                <Pattern>%d [%20.20t] [%10.10X{pegathread}] [%20.20X{tenantid}] [%20.20X{app}] (%30.30c{3}) %-5p %X{stack} %X{userid} - %m%n</Pattern>
                <!--Deny message logged under ALERT log level-->
                <ThresholdFilter level="ALERT" onMatch="DENY" onMismatch="NEUTRAL"/>
                <TimeBasedTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="250 MB"/>
            <DefaultRolloverStrategy max="20"/>

This logs to one file with a static file name. For example, PegaRULES.log.

The content is moved to another file, for example, PegaRULES-08-20-2018.log.

However, the system continues to log to PegaRULES.log.

According to the Apache website, the RollingFileAppender works in Log4j2 2.8. However, the RollingRandomAccessFile does not work according to the JIRA item.

Published October 28, 2018 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us