I have a mule flow within which I am logging the entire payload in String format by following code snippet
<logger level="ERROR" message="#[payload:java.lang.String]"/>
Now if the error occurs there really is no need to print the entire payload. The payload object in the message is null and the exception payload is populated with the relevant exception in it.
If I can print just the exception payload in String format, that would suffice. Does any one know how to log the exception payload from the message ?
<logger level="ERROR" message="
#[groovy:message.getExceptionPayload().getRootException().getMessage()]" />
The above code extracts the message related to the cause of exception.
Quite simply:
<logger level="ERROR" message="#[exception]"/>
small correction in the expression use:
[groovy:message.getExceptionPayload().getRootException().getMessage()]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With