Log entry
Syntax
log($message)
log($message, $arguments)
Description
Writes an entry to the application log.
Parameters
Name | Type | Description | Mandatory | Default |
---|---|---|---|---|
message | String | The message to be written to the log. If arguments is also specified, placeholders in the form of {0}...{n} can be defined in the message. If the message contains a placeholder but there is no argument to fill it, {n} is written to the message in plain text. |
yes | |
arguments | Set | Arguments to be inserted into the placeholders of message in the specified order. If no or too few placeholders are specified, then not all arguments will be used. |
no |
Examples
Simple log message
log('Hello');
Output (in log): Hello
Placeholder Log Message
log('Current date: {0}. Current week day: {1}', today(), today().toUserCalendar().dayOfWeek())
Output (in log): Current date: 14.02.22 16:00. Current week day: 2
Placeholder with too few arguments
log('Current date: {0}. Current week day: {1}')
Output (in log): Current date: {0}. Current week day: {1}.
Since no arguments were specified, the placeholders are not replaced and output like this.
Placeholder with too many arguments
log('Current date: {0}', today(), today().toUserCalendar().dayOfWeek())
Output (in log): Current date: 14.02.22 16:00
There are more arguments than placeholders, so the second argument is ignored.