You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jason Chaffee <jc...@shopzilla.com> on 2012/12/17 10:02:31 UTC

onException

I am trying to log the exception with an onException.  The problem is that I am not seeing the stacktrace, or the body even though I have the parameters set to true.  Does anyone see anything in particular that is wrong with what I am doing?

  onException(classOf[Exception])
    .routeId("ExceptionHandler")
    .handled(true)
    .log(LoggingLevel.DEBUG, "Sending ${body} to error log")
    .to("log:com.mycompany.camel?level=ERROR&showException=true&showStackTrace=true&showHeaders=true&showBody=true")\


Jason


Re: onException

Posted by Jason Chaffee <jc...@shopzilla.com>.
Because it is in Scala.



On 12/17/12 1:07 AM, "Charles Moulliard" <ch...@gmail.com> wrote:

>Hi Jason,
>
>To be able to answer to your question, we should see the routes that you
>have created and used in combination with the interceptor (onException).
>Why do you use (onException(classOf[Exception])) and not
>onException(Exception.class) ? Your problem could be related to the fact
>that camel is not able to match the real exception with
>classOf[Exception].
>
>Regards,
>
>
>
>On Mon, Dec 17, 2012 at 10:02 AM, Jason Chaffee
><jc...@shopzilla.com>wrote:
>
>> I am trying to log the exception with an onException.  The problem is
>>that
>> I am not seeing the stacktrace, or the body even though I have the
>> parameters set to true.  Does anyone see anything in particular that is
>> wrong with what I am doing?
>>
>>   onException(classOf[Exception])
>>     .routeId("ExceptionHandler")
>>     .handled(true)
>>     .log(LoggingLevel.DEBUG, "Sending ${body} to error log")
>>
>> 
>>.to("log:com.mycompany.camel?level=ERROR&showException=true&showStackTrac
>>e=true&showHeaders=true&showBody=true")\
>>
>>
>> Jason
>>
>>
>
>
>-- 
>Charles Moulliard
>Apache Committer / Sr. Enterprise Architect (RedHat)
>Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com


Re: onException

Posted by Charles Moulliard <ch...@gmail.com>.
Hi Jason,

To be able to answer to your question, we should see the routes that you
have created and used in combination with the interceptor (onException).
Why do you use (onException(classOf[Exception])) and not
onException(Exception.class) ? Your problem could be related to the fact
that camel is not able to match the real exception with classOf[Exception].

Regards,



On Mon, Dec 17, 2012 at 10:02 AM, Jason Chaffee <jc...@shopzilla.com>wrote:

> I am trying to log the exception with an onException.  The problem is that
> I am not seeing the stacktrace, or the body even though I have the
> parameters set to true.  Does anyone see anything in particular that is
> wrong with what I am doing?
>
>   onException(classOf[Exception])
>     .routeId("ExceptionHandler")
>     .handled(true)
>     .log(LoggingLevel.DEBUG, "Sending ${body} to error log")
>
> .to("log:com.mycompany.camel?level=ERROR&showException=true&showStackTrace=true&showHeaders=true&showBody=true")\
>
>
> Jason
>
>


-- 
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Re: onException

Posted by Jason Chaffee <jc...@shopzilla.com>.
Thanks.  I thought that might have something to do with it.


On 12/17/12 1:08 AM, "Claus Ibsen" <cl...@gmail.com> wrote:

>Hi
>
>You are handling the exception (eg handled=true) so there is no
>exception on the Exchange.
>On the log you need to enable showCaughtException=true, as it can then
>grab the caused exception that was handled and show it in the log.
>
>
>On Mon, Dec 17, 2012 at 10:02 AM, Jason Chaffee <jc...@shopzilla.com>
>wrote:
>> I am trying to log the exception with an onException.  The problem is
>>that I am not seeing the stacktrace, or the body even though I have the
>>parameters set to true.  Does anyone see anything in particular that is
>>wrong with what I am doing?
>>
>>   onException(classOf[Exception])
>>     .routeId("ExceptionHandler")
>>     .handled(true)
>>     .log(LoggingLevel.DEBUG, "Sending ${body} to error log")
>>     
>>.to("log:com.mycompany.camel?level=ERROR&showException=true&showStackTrac
>>e=true&showHeaders=true&showBody=true")\
>>
>>
>> Jason
>>
>
>
>
>-- 
>Claus Ibsen
>-----------------
>Red Hat, Inc.
>FuseSource is now part of Red Hat
>Email: cibsen@redhat.com
>Web: http://fusesource.com
>Twitter: davsclaus
>Blog: http://davsclaus.com
>Author of Camel in Action: http://www.manning.com/ibsen
>


Re: onException

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You are handling the exception (eg handled=true) so there is no
exception on the Exchange.
On the log you need to enable showCaughtException=true, as it can then
grab the caused exception that was handled and show it in the log.


On Mon, Dec 17, 2012 at 10:02 AM, Jason Chaffee <jc...@shopzilla.com> wrote:
> I am trying to log the exception with an onException.  The problem is that I am not seeing the stacktrace, or the body even though I have the parameters set to true.  Does anyone see anything in particular that is wrong with what I am doing?
>
>   onException(classOf[Exception])
>     .routeId("ExceptionHandler")
>     .handled(true)
>     .log(LoggingLevel.DEBUG, "Sending ${body} to error log")
>     .to("log:com.mycompany.camel?level=ERROR&showException=true&showStackTrace=true&showHeaders=true&showBody=true")\
>
>
> Jason
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen