Wednesday, April 10, 2019

Logging in Pega PRPC - Part 2

Logging in Pega PRPC - Part 2

In this blog, we will see about logging the pega rules in log file for debugging purpose. But once debugging is done, it should be removed, else performance of the application will be bad.

How this can be achieved, has been given in detail in the pega PDN link below:
https://community.pega.com/knowledgebase/articles/log-customization-prloggingxml-file#capture

From the above link we had taken small part, which is logging the rules.
By Adding the below format in the prlog4j2.xml file in 7.3 version and out of the log file will be as shown below:

Sample format in the XML:
Under loggers object, you need to add this logger tag name.
name will be the rule type,which we need to trace or debug, but it should be given in java class.

The format for the Pega 7 Platform Java class instances is a three-part name, separated by periods.


  1. The leftmost part refers to whether the object in question is an activity, a when rule, or a model. The name refers to the class of those objects: Rule-Obj-Activity, Rule-Obj-When, or Rule-Obj-Model, with underscores instead of hyphens.
  2. The middle portion of the reference is the actual name of the object (the activity, when block, or model).
  3. The final portion of the reference is the class on which the activity, when or model is defined. For the example above, the reference would be: Rule_Obj_Activity.Validate.Work_General


If the final portion of the name was omitted (Rule_Obj_Activity.Validate), then messages for all Validate activities would print out, regardless of in what class they were defined. Likewise, if developers are interested in printing out messages for all Activities, they should use the first part of the reference (Rule_Obj_Activity), to get all messages for activities.

<Loggers>
<Logger name="Rule_Obj_Activity" additivity="false" level="info">
<AppenderRef ref="PEGA"/>
</Logger>

<Logger name="Rule_Obj_Model.pyDefault" additivity="false" level="info">
<AppenderRef ref="PEGA"/>
</Logger>
</Loggers>

Sample log file generated:

2019-04-10 23:14:45,091 [http-nio-8080-exec-3] [  STANDARD] [                    ] [       VISA:01.01.01] (Rule_Obj_Activity.Invoke.Rule_Connect_REST.Action) INFO  localhost|0:0:0:0:0:0:0:1 Author.VISA - Starting remote service invocation...
2019-04-10 23:14:50,048 [http-nio-8080-exec-3] [  STANDARD] [                    ] [       VISA:01.01.01] (Rule_Obj_Activity.Invoke.Rule_Connect_REST.Action) INFO  localhost|0:0:0:0:0:0:0:1|Rule-Connect-REST.Pega-Int-PDN-Rss.pyRSSConnectService Author.VISA - Finished remote service invocation

Above log file has been generated, when Rule_Obj_Activity.Invoke.Rule_Connect_REST.Action this activity is called during execution.

No comments:

Post a Comment