...
To provide some examples and templates, there are a number of pre-existing files with the name apl-log4j-<log level name>.properties
, for example apl-log4j-trace.properties
, which you can use to either copy properties from, or make a copy of the whole file and rename it to <ec-name>-apl-log4j.properties.
Info | |
---|---|
title | Example. Configuration filenamesDefault configuration file:
EC specific configuration file for ec1:
Copying the default configuration file into an EC specific configuration file:
Copying a template configuration file into an EC specific configuration file: |
The following template configuration files are included by default:
apl-log4j-off.properties
apl-log4j-fatal.properties
apl-log4j-error.properties
apl-log4j-warn.properties
apl-log4j-info.properties
apl-log4j-debug.properties
apl-log4j-trace.properties
apl-log4j-all.properties
The files listed above have a different log level setting but are otherwise identical.
The content of the files defines the logging.
Info |
---|
Example. Configuration file contents
|
The first line in the example above sets the log level and declares an "appender" named 'a'
. The available log levels are listed below in order of severity, from highest to lowest:
OFF
FATAL
ERROR
WARN
INFO
DEBUG
TRACE
ALL
Messages of the same or higher severity than the selected level are logged. For instance, if the configured log level is WARN
, messages with the severity ERROR
and FATAL
will be logged as well. The other settings above mean that messages are logged in files that are started, stopped and stored in JSON formatted files in the $MZ_HOME/log
directory in regular intervals. When an active log file has reached its maximum size, it is backed up and stored with a number suffix. A new active log file is then created. The default maximum size is 10 MB, and the default number of backup files is one (1).
...
Which workflows are written into which appender is based on the log4j.logger.<class name> property.
Info | |||||||
---|---|---|---|---|---|---|---|
title | Examples Appender Configurations
The appender named Default will write a single file for all workflows contained under the Default folder.
The appender named Primary will create multiple files; one for each workflow instance based on the RT_Folder.RT_TEST_WF workflow.
The appender Secondary will create a single file for each workflow instance based on the RT_Folder.RT_TEST_WF workflow. The file will take the name of the first workflow instance it encounters, for example "RT_Folder.RT_TEST_WF.workflow_1" |
Tip | ||||||
---|---|---|---|---|---|---|
title | Hint!You can change the maximum file size and the number of backup files by adding the following lines:
If you want to apply the filtering rule to all APL configurations in the default folder, change the last line in the previous example to log4j.logger.Default=DEBUG . |
Note | |
---|---|
title | Note!For performance reasons it is recommended to use the |
...
The following functions are used to trigger logging within any of the function blocks in APL:
void log.fatal(any, any)
void log.error(any, any)
void log.warn(any, any)
void log.info(any, any)
void log.debug(any, any)
void log.trace(any, any)
For more information about these functions, see Log and Notification Functions in the APL Reference Guide.
Log Output
The output log files are stored in the directory specified in the active logging configuration.
Info | |
---|---|
title | Example. Log file in JSON format{"timestamp":"2015-12-20:22:44:10 UTC","level":"DEBUG","thread":"Default.logtestwf.workflow_1: TCP_IP_1_1","category":"Default.logtestwf.workflow_1.Analysis_1","message":"In consume","pico":"EC1","workflow":"Default.logtestwf.workflow_1","agent":"Analysis_1"} |
The fields in the log output are described below.
Field | Description |
---|---|
timestamp | The time when the message was logged. The UTC timezone and international standard date and time notation is used by default.
For information about how to use SimpleDateFormat patterns, see: |
level | The log level i e |
thread | The name of the workflow thread. |
category | The logged configuration. This field contains the |
message | The log message is specified in the APL command. |
pico | The name of the Execution Context. |
Warning |
---|
Warning!The ECs must be restarted if you manually delete or rename active log files or backup log files. |
Tip |
---|
Hint!If the log files are not generated as expected, review the EC logs. Your configuration files may contain errors. |