Contact Free trial Login

Logger Component

This Core component can help you monitor or even debug your Mule app by logging important information such as error messages, status notifications, payloads, and so on. You can add a Logger anywhere in a flow, and you can configure it to log a string that you specify, the output of a DataWeave expression you write, or any combination of strings and expressions.

Keep in mind that the Logger is one of the only components that supports mixing Strings and expressions within a value. DataWeave String interpolation or concatenation within a single expression should be used elsewhere.

The configured messages are logged to the app’s log file. In Studio, they appear in the Console. The following example displays the message in Set Payload in a browser while logging the message, as well.

logger flow
Example: XML Configuration of the Flow
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081"/>
<flow name="logger-example-Flow">
  <http:listener config-ref="HTTP_Listener_Configuration" path="/"/>
  <set-payload value="Hello MuleSoft!"/>
  <logger message="#[payload]" level="INFO"/>

Logger Configuration

Field Value Description Example


String or DataWeave expression

Specifies the Mule log message. By default, messages are logged to the application’s log file.

message="Current payload is #[payload]"


Available options:


Specifies the log level.




Optional setting that specifies a category name that it adds to log4j2.xml file. For example, you might use a category to route your log messages based on your category, or you might set log levels based on category.



This Logger is set to monitor message processing status, mixing Strings and expressions:

<logger category="monitoring" message="Message #[] processed successfully" level="INFO"/>

This Logger set to record the processing time of a flow, using a single expression and DataWeave’s String concatenation:

 <logger category="performance" message="#['Message ' ++ ++ ' took ' ++ vars.processingTime ++ ' milliseconds to process']" level="INFO"/>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.