Log-Message method
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.
Additions 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:
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:
You can include a linked property reference in the expression. |
LoggingLevel |
Optional. Enter one of the following values:
Choose a type; the default value is
Messages appear when their
LoggingLevel
parameter equals
or is more severe than the internal logging level setting. If you choose
If you choose
|
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 check box 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
prlog4j2.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
prlog4j2.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 check box is selected on the Tracer Settings panel.
When 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
prlog4j2.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.
Previous topic Using the Load-DataPage method Next topic Map-Structured method