DataWeave Logging — Print Logs From DataWeave2.0

Hi Muleys,

This article is about printing the logs directly in the output console(after deployment) without using an additional logger component.

We know how to print the logs using the logger component but to print specific values or fields directly from DataWeave/Transform Message component will be more helpful and Dev-Friendly as Developers can print the specific values what they want. It is useful to print only required information rather than printing the whole data which may contain sensitive or PII information.

Example:  This example shows how to log the result of the CandidateInfo without changing any original values in the DataWeave.

DataWeave Code

Plain Text


Console Output

console output

Plain Text


Expression Output

JSON


Conclusion

Using Log Function in DataWeave/Transform Message component, we filtered out the sensitive value and logged what we want, directly in the output Console.

Happy Learning!

 

 

 

 

Top