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

Log entries are writing to custom log and Pega log

SA-23029

Summary



User added an appender for custom logs. The log entries are writing to both Pega log and custom log.
User's business requirement is to write business log entries to business log only separate from standard pega log. User requires to know how to bifurcate custom and pega logs to separate log files?


Error Messages



 Not Applicable.


Steps to Reproduce



1. Add below lines to prlogging.xml

<appender name="CustomAppender" class="com.pega.pegarules.priv.util.DailySizeRollingFileAppenderPega">
<param name="FileNamePattern" value="'/logs/path/XXXX-Int-Custom--'yyyy-MMM-dd'.log'"/>
<param name="MaxFileSize" value="50MB" />
<layout class="com.pega.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n" />
</layout>
</appender>

<category name="Rule_Obj_Activity.WriteRequestResponse.XXXX_FW_YYYY_Work.Action">
<priority value="info"/>
<appender-ref ref="CustomAppender"/>
</category>


Root Cause



How to question.

Resolution



Perform the following local-change: 

Modify prlogging.xml to add the log appenders as below :


<appender name="ASYNC" class="com.pega.apache.log4j.AsyncAppender">
        <param name="BufferSize" value="512"/>
        <param name="Blocking" value="false"/>
        <filter class="com.pega.apache.log4j.varia.LevelMatchFilter">
            <param name="LevelToMatch" value="ALERT"/>
            <param name="AcceptOnMatch" value="false"/>
        </filter>
  <!-- Introducing the appenders below to filter out and bifurcate PEGA and BUSINESS log messages  -->
        <appender-ref ref="PEGA-LOGGER"/>
    </appender>

<appender name="PEGA-LOGGER" class="com.pega.apache.log4j.AsyncAppender">
        <param name="BufferSize" value="512"/>
        <param name="Blocking" value="false"/>
         <filter class="com.pega.apache.log4j.varia.StringMatchFilter">
                  <param name="StringToMatch" value="INFO UNIQUE_ID" />
                  <param name="AcceptOnMatch" value="false" />
        </filter>
        <appender-ref ref="PEGA"/>
        <appender-ref ref="CONSOLE"/>
    </appender>

 <category name="Rule_Obj_Activity.WriteRequestResponse.XXXX_FW_YYYY_Work.Action">
        <priority value="info"/>
        <appender-ref ref="BUSINESS-LOGGER"/>
    </category>

<appender name="BUSINESS-LOGGER" class="com.pega.apache.log4j.AsyncAppender">
        <param name="BufferSize" value="512"/>
        <param name="Blocking" value="false"/>
         <filter class="com.pega.apache.log4j.varia.StringMatchFilter">
                  <param name="StringToMatch" value="INFO UNIQUE_ID" />
                  <param name="AcceptOnMatch" value="true" />
        </filter>
        <filter class="com.pega.apache.log4j.varia.DenyAllFilter"/>
        <appender-ref ref="CustomAppender"/>
    </appender>

<appender name="CustomAppender" class="com.pega.pegarules.priv.util.DailySizeRollingFileAppenderPega">
      <param name="FileNamePattern" value="'/logs/path/XXXX-Int-Custom-'yyyy-MMM-dd'.log'"/>
      <param name="MaxFileSize" value="50MB" />
      <layout class="com.pega.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%m%n" />
      </layout>
    </appender>

Published May 23, 2016 - 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?

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