Log Message
Log messages on the IBM RPA Studio console or the IBM RPA Control Center. If necessary, it also logs messages to the Windows Event Log. {# :shortdesc}
Robot executions by IBM RPA Studio log messages on the console of that same tool. The remaining runs log messages on the IBM RPA Control Center.
Syntax
logMessage --message(String) --type(EventType) [--logonwindows(Boolean)] [--logname(String)] [--source(String)] [--eventid(Numeric)]
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Message | message |
Required |
Text |
The message to return as an output. |
Type | type |
Required |
EventType |
Type of event the logged message. For more information on what types are accepted, see type parameter options. Note:Types correspond to the logging level on the Windows Event Viewer. To use this function, enable the Log on Windows event parameter.
|
Log on Windows event | logonwindows |
Optional |
Boolean |
Option that allows logging the message on the Windows Event Log, which is displayed on the Windows Event Viewer. |
Log | logname |
Optional. Visible only if logonwindows is enabled |
Text |
Log Name where the event is recorded on the Windows Event Viewer. For more information, see logname parameter options. |
Source | source |
Optional. Visible only if logonwindows is enabled |
Text |
Source corresponding to the application that generated the event log, which must be an existing application in Windows. Note:If no data is defined, the default is "Application".
|
Event id | eventid |
Optional. Visible only if logonwindows is enabled |
Number |
Identification number for the event log on the Windows Event Viewer. |
type
parameter options
The following table displays the options available for the type
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Error | Error |
Error is the type of event that the logged message fits into. |
Information | Info |
Information is the type of event that the logged message fits into. |
Warning | Warning |
Warning is the type of event that the logged message fits into. |
logname
parameter options
The following table displays the options available for the logname
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Application | application |
The message is logged as an Application log in the Windows Event Viewer. |
Safety | safety |
The message is logged as a Safety log in the Windows Event Viewer. |
Configuration | configuration |
The message is logged as a Configuration log in the Windows Event Viewer. |
System | system |
The message is logged as a System log in the Windows Event Viewer. |
Events forwarded | eventsforwarded |
The message is logged as an Events forwarded log in the Windows Event Viewer. |
Example
Example 1: Displays a message written directly to the Message parameter.
logMessage --message "Execution occurred without errors!\r\n" --type "Info"
// Return the following output on the console:
// "Execution occurred without errors!"
Example 2: Displays the contents of the variable "numericValue" along with the informative text "The contents of the variable 'numericValue' is:".
defVar --name numericValue --type Numeric --value 100
logMessage --message "The content of the variable \"numericValue\" is: ${numericValue}" --type "Info"
// Return the following output on the console:
// The content of the variable 'numericValue' is: 100
Example 3: Displays an "Error" text message logged on the Windows Event Viewer in the "Application" log.
logMessage --message "Execution occurred with errors and will be logged on the Windows Event Viewer." --type "Error" --logonwindows --logname Application --source Application --eventid 2019
// Return the following output on the console:
// [Error] Execution has occurred with errors and will be logged on the Windows Event Viewer.