Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print exception payload within mule message flow

Tags:

mule

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 ?

like image 379
MemeMe Avatar asked Feb 06 '14 20:02

MemeMe


3 Answers

    <logger level="ERROR" message=" 
#[groovy:message.getExceptionPayload().getRootException().getMessage()]" /> 

The above code extracts the message related to the cause of exception.

like image 56
tortoise Avatar answered Oct 03 '22 20:10

tortoise


Quite simply:

<logger level="ERROR" message="#[exception]"/>
like image 23
Anton Kupias Avatar answered Oct 01 '22 20:10

Anton Kupias


small correction in the expression use:

[groovy:message.getExceptionPayload().getRootException().getMessage()]
like image 2
Anil Avatar answered Oct 02 '22 20:10

Anil