- 3 minutes to read

Enable Logging using Business Events

Log your messages from Mule ESB with the Logger element.

Tip

Consider using the Nodinite Logging Custom Connector instead of the built-in Logger shape

Features

  • Events
    • Messages
    • Context Properties

Configuration

In your Mule Flow, add at least

  • Set Session Variable
  • Logger or Business Event
    flow example

Local Interchange ID

runID
sessionvariable

Review the Mule ESB Correlation user guide for additional information.

All events and messages in a flow (run) should be logged with the same local interchange id making all of these related events groupable. By using a Session Variable named runID this behaviour will be automatically governed for.

In your flow, make sure to start the flow by assigning a session variable

<set-session-variable variableName="runID" value="#[java.util.UUID.randomUUID().toString()] doc:name"Session Variable"/>

xml example for setting runID as as Session Variable

Mule Flow - Logger element

Use the Logger element in the Mule Flow to log messages to Nodinite, this pattern works for both On-Prem and Cloudhub solutions.
Logger_Element

Configure the Logger element:
Logger_Configuration

    <logger level="INFO" doc:name="Logger (IN)" message="im_logText=File transfer, receive message, im_messageContext=#[message], im_messageType=, im_messageBody=#[message.payloadAs(java.lang.String)], im_endPointName=FileTransfer Receive, im_endPointDirection=Receive" />

Supported properties

im_logText - informal text, Optional
im_endPointName - the End Point name, Mandatory
im_endPointDirection - the Endpoint direction, Valid values are: None, Unknown, Receive, Send, TwoWayReceive, TwoWaySend im_endPointTypeId - the Endpoint type id, Integer see Endpoint Types for valid codes, Optional
im_endPointUri - the Endpoint URI, Optional (overrides the Endpoint URI set by the log agent. Set \ at the end to mark the URI as a folder for local paths)
im_messageType - the Message Type, Optional
im_messageContext - the message context properties, #[message], Optional
im_messageContextCustom - a custom message context properties, key value pair of type <string,string> {"key1":"value1", "key2":"value2"} example {"transactionId":"FA0CAE5C-8968-44DF-836D-1DAA57D7831B","orderId":"1234"}, Optional
im_messageBody - the message payload, #[message.payloadAs(java.lang.String)], Optional
im_logStatusCode - the message status, Signed integer, Optional
im_integrationName -the name of the Integration. If this value is provided together with im_serviceName and/or im_contractName this Integration will be set for the Service and/or Contract, Optional
im_serviceName - the name of the Service. A Transport Contract is created with Message Type and Endpoint, if im_contractName is set only the Message Type will be set on the Transport Contract, Optional
im_serviceDirection - the direction of the Service, if not set the direction of the Endpoint will be used, Optional
im_serviceSystemName - the name of the System used for the Service, Optional
im_contractName - the name of the Contract. If this value is provided together with im_serviceName, the service will be set on the Contract, A Transport Contract is created with Message Type and Endpoint, Optional
im_contractSystemName - the name of the System used for the Contract, Optional

An event is logged to Nodinite if the mandatory properties exists.

Nodinite can extract the message type automatically from XML messages.

Log status code can be used to highlight errors, i.e. in a Mule exception handling element.

Exception information can be logged with

#[groovy:message.getExceptionPayload().getException().getCause()] and
#[groovy:message.getExceptionPayload().getException()]

EndpointTypeId

These codes are valid codes to be used with the im_endPointTypeId property:

See the list of Endpoint Types for available id:s to use


Next Step

Add or manage Log Agents
Add or manage Log View
Install Mule Log Agent
Configuration of the agent

Log Views
Log Agents