Log and Notification Functions (4.0)
The following functions are used for debugging APL code, or logging user defined messages and events.
The following functions for Log and Notification described here are:
debug
Prints the supplied argument to the output target specified in the Execution tab of the Workflow Properties dialog. Valid options are Event or File . If File is selected, the debug is saved in the temporary directory as stated in the system property pico.tmpdir
. The file is to be called debug/<workflow name>
. Each time the workflow is activated resulting in new debug information being written, the existing file is overwritten. If Event is selected, the output is shown in the Workflow Monitor.
void debug( arg )
Â
Parameter | Description |
---|---|
| Argument to write to debug output. Could be any type. Note that printing a UDR type will dump all the field values, which may be a large amount of data. Similarly, the debug output for a table or list type may be very large. There is a special case if For all other variable types, the output is the direct string conversion, meaning |
Returns | Nothing |
dispatchAlarmValue
The function makes it possible to detect alarm situations based on workflow behavior. It dispatches a user defined <value>
with a user defined valueName from the workflow. The valueName used must be defined using Alarm Detection. For further information, see Alarm Detection in the Desktop user's guide.
void dispatchAlarmValue(string <"valueName">, long value)
Â
Parameter | Description |
---|---|
| The workflow alarm value name, as defined in the Alarm Detection Editor |
| Any value to be associated with the name |
Returns | Nothing |
Â
Example - Using dispatchAlarmValue
The following code example displays a situation and syntax useful for the dispatchAlarmValue
.
consume {
if ( timeToPay ) {
udrRoute(chargingUdr, "to_billing");
//Enable for 'amount out of range' Alarm Detection
dispatchAlarmValue("chargingAmount", chargingUdr.amount);
}
}
dispatchEvent
A user can define a customized event type. This is done using an event UDR, optionally extended with user-defined fields. This event UDR can be populated with any information by utilizing APL code, and then be sent on, using the dispatchEvent
function, to be caught by the Event Notification. For further information about Event Notification, see Event Notifications(4.0) in the Desktop user's guide.
Â
Parameter | Description |
---|---|
| The name of the event UDR |
Returns | Nothing |
dispatchMessage
This method is used to produce user-defined messages associated with predefined Event Categories. For further information about the Event Notification editor, see Event Notifications in the link above. For instance, an Event Category could be named 'DISASTER', and be configured to send an email to the System Administrator. Then an APL agent could send a detailed description with the dispatchMessage
function whenever this error situation is detected.
Â
Parameter | Description |
---|---|
| Value/message to append to the Event Category |
| Name of a user-defined event as declared in the Event Notification Editor. This event must be defined in the Event Notification Editor in order for the APL code to compile. |
Returns | Nothing |
log*
Logs a message string to the System Log of type error, warning or information. The entry will fall under the Workflow category where workflow name will be the name of the current workflow and agent name will be the name of the agent logging the message.
Â
Parameter | Description |
---|---|
| A main message appearing in the log |
| Name of an optional parameter. If declared, |
| Value of an optional parameter. If declared, |
Returns | Nothing |
Â
Example - Using logWarning
The following code example logs a warning message, which when displayed in the System Log will look like the following figure:
log.*
These functions invokes logging with log4j. For information about how to configure the logging, see Customizing APL Logging for ECDs (4.0).
Â
Parameter | Description |
---|---|
| A value that will be appear in the |
tag | Objects(s) that will appear in the |
Returns | Nothing |
Â
Example - Using log.debug
mailNotify
Sends an email to a configured recipient. In order to operate, the system must have an email remitter and an SMTP mail server defined. For further information on Platform properties, see Platform in the System Administrator's Guide.
Â
Â
Parameter | Description |
---|---|
| Email address to the recipient on the form: "user@xxx.com" |
| Text ending up as the email subject |
| Message string ending up as the body of the email |
| Name or address of the sender of the email |
attachment | A list that will contain one or many attachments to be sent with the email. Each list entry will be the full directory path of the attachment. |
Returns | Nothing |
mailNotifyHtml
Sends an email in HTML format to a configured recipient. To operate, the system must have an email remitter and an SMTP mail server defined. For further information on Platform properties, see Platform in the System Administrator's Guide.
Â
Â
Parameter | Description |
---|---|
| Email address to the recipient on the form: "user@xxx.com" |
| Text ending up as the email subject |
| Message string ending up as the body of the email |
| Name or address of the sender of the email |
attachment | A list that will contain one or many attachments to be sent with the email. Each list entry will be the full directory path of the attachment. |
Returns | Nothing |
Â