On Tue, Jun 29, 2010 at 11:55 AM, Nav <[email protected]> wrote:
>
> HI,
>   We have a requirement that, on error in any of our routes, the error
> stack trace should be emailed to the developers. I am using Camel 2.3.0. I
> am not able to get the stack trace in the processor. Please let me know what
> is the best way to do this .
>
>   I have the following common error handling route.
>
>         <handled>
>              <constant>true</constant>
>            </handled>
>            <process ref="errorHandler" />
>            <convertBodyTo type="java.lang.String"  />
>           <!--   MAIL COMPONENT HERE  -->
>          </onException>
>
>
> In the processor 'errorHandler', I am doing the following:
>
> public class ErrorHandler implements Processor {
>    public void process(Exchange exchange) throws Exception {
>        Exception c = exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
>                          Exception.class);
>                   exchange.getIn().setBody(c.getStackTrace());
>    }
> }
>
>
>
> The result I get instead of the stack trace is :
> [Ljava.lang.StackTraceElement;@4051b1fb
> which is the object representation of the stacktrace element.
>

Google for how to retrieve the stacktrace in a human readable manner.
You need to print it to a write as far as i remember.




> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Error-Handling-problem-while-trying-to-get-stack-trace-tp511830p511830.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to