Version: 17.01
Supported Since: 17.01
A Logger is a processing element which can be used print to log lines to the console. Moreover it can be used to log headers, message properties, scope variables, message payload, message id or simply just a plain text message. Logger processing element can be used anywhere in the flow. Logger processing element uses log4j 2.x async logging which is configured using log4j2.xml file.
In the following use case, logger processing element is used to log message payload, message ID and content-type transport header to the console. Here to demonstrate the logger operation, NIO HTTP Ingress Connector and NIO HTTP Egress Connector is used. Complete flow for the use case is shown below.
Configuration of the Logger processing element is shown below.
When a message is sent to the endpoint which NIO HTTP Ingress Connector is configured to listen to, following log line will be printed to console.
INFO LoggerProcessingElement Payload: Sample Payload MessageID: d22cfefb-ef01-ff78-0000-000000000004 ContentType: text/xml; charset=UTF-8
Next |
The message will be sent to this outport if logging is successful |
On Exception |
The message will be sent to this outport if the processing element failed in logging operation |
Log Template * |
Basic |
This parameter which can be a plain text log message or can be any combination of following.
Few example log templates are shown below.
Further following place holders can be used to get the current timestamp.
|
||||
Log Level * |
Basic |
Log level for the message. Possible values are as follows. Note that these values have the same meaning as log4j log levels.
|