Back Forward Log-Message method

Methods and instructions by function

Use the Log-Message method to append a message to the Pega log when the step is reached. Depending on method parameters and the current logging level, a line is added to the Pega log on the current node.

CautionAdditions to the Pega log consume system resources. Select the LoggingLevel parameter carefully. For best performance, remove or convert to comments the steps containing this method when they are no longer needed.

Parameters

The Log-Message method accepts four parameters:

Parameter

Description

Message

Enter the text of the message between double quotes, or an expression that results in a text value. For example:

"Test45: Work item "+.pyID+" status= "+ .pyStatusWork

The predefined Java variable myStepPage identifies the step page of the method. For example, to include the entire contents of the step page in the log as an XML document, set the Message parameter to:

"The step page:" + @getStepPageHandle(tools) + "contains the following properties:\n + @getXMLOfPage(myStepPage)

You can include a linked property reference in the expression.

LoggingLevel

Optional. Enter one of the following values:

  • Debug — Record as DEBUG severity, produces the largest number of messages; least severe.
  • Info — Record as INFO severity
  • Warn — Record as WARN severity
  • Error — Record as ERROR severity; most severe.
  • InfoForced — Always record as INFO event.

Choose a type; the default value is INFO. The initial prlogging.xml file installed with PRPC shows only Error severity.

Messages appear when their LoggingLevel parameter equals or is more severe than the internal logging level setting. If you choose Debug, Info, or Warn, use the Set Logging Levels tool if needed to cause these messages to appear as you debug the activity.

CautionIf you choose InfoForced, a message is added to the Pega log each time the method executes, independent of settings in the prlogging.xml file or settings through the Set Logging Levels tool. To reduce clutter in the Pega Log and improve performance, be sure to remove such InfoForced steps, or convert them to comments, in production systems.

GenerateStackTrace

Select to cause execution of this method to create a Java stack trace in the Pega log, in addition to other results. If the SendToTracer checkbox is selected, the stack trace also appears in the Tracer tool output.

SendToTracer

Select to cause a Tracer event when this method executes, in addition to other results.

Results

If the LoggingLevel parameter is set to InfoForced, a message is added to the Pega log on the current node.

If the LoggingLevel parameter is set to Debug, Info, Warn, or Error, results of this method depend on a comparison of the LoggingLevel parameter with the prlogging.xml setting on the current node for the Rule-Obj-Activity class. If the value of the parameter is equal to or greater than the severity value of the setting, the message is added to the log and other processing occurs as described above. You can temporarily override the setting in the prlogging.xml file using the Set Logging Level tool. Severity levels range from DEBUG (lowest level, most messages) to INFO, WARN, ERROR, and FATAL (highest level, fewest messages).

If requested, a Java stack trace is also added to the Pega log. If requested, a Tracer event is generated. These events appear in Tracer output if the Log-Message checkbox is selected on the Tracer Options form.

NoteWhen debugging is complete, you can delete the steps that use this method or change them to comment steps. This is needed for steps where LoggingLevel is set to InfoForced. For others, if the prlogging.xml setting for the Rule-Obj-Activity class is higher than the LoggingLevel parameter, executing this method does not update the Pega log and does not affect performance.

Checking the method status

This method updates the pxMethodStatus property. See How to test method results using a transition.

Notes

This method is a wrapper for the Java LogHelper class for logging diagnostic data. When practical, use this method rather than a Java step to add to the Pega log.

Definitions Pega log file
Related topics About the Set Logging Levels tool

UpMethods and instructions by function