---
schema_version: "1"
id: 4090ff5c93aa141eaa56a019f20bb1f8a52289a3fb61c5ec01ea01be0f7480d0
title: Logger Component
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-runtime/4.3/logger-component-reference.md
canonical_url: https://docs.mulesoft.com/mule-runtime/4.3/logger-component-reference
source_site: docs.mulesoft.com
content_type: documentation
content_hash: ad844393445540ea242f3bc4f49e686315d7c01b6ef91ab9abb99585e85dd691
description: MuleSoft Documentation Site
release: "4.3"
latest: false
---
---
product: Mule Runtime
version: 4.3
keywords: mule, esb, studio, logger, logs, log, notifications, errors, debug
---

# Logger Component

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

This Core component helps you monitor and debug your Mule application 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.

> [!WARNING] 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, which is located in
`MULE_HOME/logs/<app-name>.log` if no custom log file path is specified in the `log4j2.xml` file.  
In Studio, the logs show in the Console.

The following example displays the message in Set Payload in a browser and also logs the message.

![logger flow](/mulesoft/current/en-us/mule-runtime/4.3/_images/logger-flow.png)

Example: XML Configuration of the Flow

```xml
<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"/>
</flow>
```

## Logger Configuration

![logger](/mulesoft/current/en-us/mule-runtime/4.3/_images/logger.png)

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Field</th><th>Value</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><div><div><p>Message</p></div></div></td><td><div><div><p>String or DataWeave expression</p></div></div></td><td><div><div><p>Specifies the Mule log message. By default, messages are logged to the application’s log file.</p></div></div></td><td><div><div><p><code>message="Current payload is #[payload]"</code></p></div></div></td></tr><tr><td><div><div><p>Level</p></div></div></td><td><div><div><p>Available options:</p></div><div><ul><li><p><code>DEBUG</code></p></li><li><p><code>ERROR</code></p></li><li><p><code>INFO</code>(Default)</p></li><li><p><code>TRACE</code></p></li><li><p><code>WARN</code></p></li></ul></div></div></td><td><div><div><p>Specifies the log level.</p></div></div></td><td><div><div><p><code>level="ERROR"</code></p></div></div></td></tr><tr><td><div><div><p>Category</p></div></div></td><td><div><div><p>String</p></div></div></td><td><div><div><p>Optional setting that specifies a category name that it adds to <code>log4j2.xml</code> 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.</p></div></div></td><td><div><div><p><code>category="MyCustomCategory"</code></p></div></div></td></tr></tbody></table>

## Examples

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

```xml
<logger category="monitoring" message="Message #[payload.id] processed successfully" level="INFO"/>
```

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

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

## See also

[DataWeave String Type](https://docs.mulesoft.com/dataweave/2.3/dataweave-types#dw_type_string)
