You are viewing an older version of this section. Click here to navigate to the latest version.

Logger Component Reference

Use the Logger to log messages such as error messages, status notifications, or exceptions. You can add a logger anywhere in a flow, and you can configure it to log anything: any string, any Mule expression, or any combination of strings and Mule expressions.



Field Value Description Example XML

Display Name


Customize to display a unique name for the logger in your application.



String or Mule expression

Specify what Mule should log. By default, messages are logged to the console in Mule Studio.

message="Current payload is #[payload]"


Select a level from the listed options:


  • WARN

  • INFO



Specify the level at which the message should be logged.

You can create this file automatically through Studio by right-clicking on your project in the package explorer, and selecting Mule > Create Log4j Configuration. Then you can find a log4j2.xml file in your project’s src/main/resources folder and edit it through Studio.



Optional . String

Optionally specify a category name and configure it in the log4j2.xml file to behave per your use case. For example, you can route log messages based on category or set log levels based on category.


# A logger set to monitor message processing status
<logger category="monitoring" message="Message #[] processed successfully" level="INFO" doc:name="Monitoring Logger"/>

# A logger set to record the processing time of a flow
<logger category="performance" message="Message #[] took #[flowVars['processingTime']] milliseconds to process" level="INFO" doc:name="Performance Logger"/>
Element Description


Use the Logger to log messages such as error messages, status notifications, or exceptions to the application’s log file.

Element Attribute Description


Specify what Mule should log. Supports expressions.


Select one of the following levels: ERROR, WARN, INFO, DEBUG, or TRACE. If no level attribute is set, the logger will log at the DEBUG level.


Optional. Specify categories to route log entries according to business needs. Configure the categories in your file.


Customize to display a unique name for the logger in your application.

Note: Attribute not required in Mule Standalone configuration.

Rather than specifying a single Mule expression in your logger message, you can embed as many expressions as you required for your use case. This allows you to give some context to what is being logged, and enables you to log multiple things at once.

For example:

<logger message="Current payload is #[payload] and the message ID is #[]" level="INFO" doc:name="Logger"/>
Keep in mind that the act of logging implies a toString() function, that in some cases may alter or consume the message.

Configuring Custom Logging Settings

By default, the logger is set to log messages asynchronously and at a level greater than or equal to INFO, and thus discards log messages at the DEBUG or TRACE level.

As from Mule runtime 3.6.0, log4j1 has been replaced by log4j2 as the backend tool for managing loggings. This implies some backwards compatibility issues as the necessary configuration files in this new framework are different. Log4j2 also allows for asynchronous logging, which wasn’t previously available, and Mule now implements this by default, as it implies a substantial improvement in performance.

If you need to use synchronized logging, change where to send the logs, adjust the logging level, or define custom categories, you can configure these properties in an XML file that specifies how the logger behaves, otherwise, use the default properties.

For instructions on how to edit these settings, see Logging in Mule.

See Also