Contact Free trial Login

log

log(String, T): T

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

This function can be used to debug DataWeave scripts until a proper debugger is incorporated. The Logger component outputs the results through DefaultLoggingService through the Logger component

Parameters

Name Description

prefix

A string that typically describes the log.

value

The value to log.

Example

This example logs the specified message. The DefaultLoggingService for the Logger component returns the message WARNING - "Houston, we have a problem." In the console, while the component’s LoggerMessageProcessor simply returns "Houston, we have a problem.", without the WARNING prefix.

Source

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

Output

WARNING - "Houston, we have a problem."