Contact Free trial Login

log

log(String, T): T

Without changing the value of the input, log returns the input as a system log.

Use this function to debug DataWeave scripts until a proper debugger is incorporated. The Logger component outputs the results through DefaultLoggingService in the console.

Parameters

Name Description

prefix

A string that typically describes the log.

value

The value to log.

Example

The following example logs the specified message. In the console, the Logger component’s DefaultLoggingService returns the message WARNING - "Houston, we have a problem." MuleSoft adds the dash - between the prefix and value.
While the Logger component’s LoggerMessageProcessor simply returns the value "Houston, we have a problem.", without the WARNING prefix.

Source

%dw 2.0
output application/json
---
log("WARNING", "Houston, we have a problem.")

Output

WARNING - "Houston, we have a problem."

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.