- 3 minutes to read

Enable Logging using the Logger Shape

Effortlessly log your Mule ESB messages with the built-in Logger element and unlock powerful monitoring and troubleshooting with Nodinite.

Tip

For advanced features and business value, consider using the Nodinite Logging Custom Connector instead of the built-in Logger shape.

Features

  • Events
    • Messages
    • Context Properties

Configuration

In your Mule Flow, always include:

  • Set Session Variable
  • Logger or Business Event
    flow example
    Example Mule flow with session variable and Logger element.

runID
sessionvariable
Session variable initialization for runID in Mule ESB.

Review the Mule ESB Correlation user guide for more information.

All events and messages in a flow (run) should use the same local interchange id to group related events. By using a Session Variable named runID, you ensure automatic correlation for all log entries.

Start your 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 a Session Variable.

Mule Flow – Logger Element

Use the Logger element in your Mule Flow to log messages to Nodinite. This pattern works for both On-Prem and Cloudhub solutions.
Logger_Element
Logger element in Mule ESB flow.

Configure the Logger element:
Logger_Configuration
Logger element configuration example.

    <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: 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; add \ at the end to mark as folder for local paths)
  • im_messageType – The Message Type, Optional
  • im_messageContext – The message context properties, #[message], Optional
  • im_messageContextCustom – Custom message context properties, key-value pair of type <string,string> (e.g., {"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, Optional
  • im_serviceName – The name of the Service, Optional
  • im_serviceDirection – The direction of the Service, Optional
  • im_serviceSystemName – The name of the System used for the Service, Optional
  • im_contractName – The name of the Contract, Optional
  • im_contractSystemName – The name of the System used for the Contract, Optional

Nodinite logs an event if all mandatory properties exist. It can extract the message type automatically from XML messages.

Use the log status code to highlight errors, for example, in a Mule exception handling element.

Log exception information with:
#[groovy:message.getExceptionPayload().getException().getCause()] and
#[groovy:message.getExceptionPayload().getException()]

EndpointTypeId

Use valid codes for the im_endPointTypeId property. See the list of Endpoint Types for available IDs.


Next Step