Laurent Chabot created CAMEL-14999:
--------------------------------------

             Summary: Camel 3 log showCaughtException is not working
                 Key: CAMEL-14999
                 URL: https://issues.apache.org/jira/browse/CAMEL-14999
             Project: Camel
          Issue Type: Bug
    Affects Versions: 3.2.0, 3.1.0, 3.0.0
            Reporter: Laurent Chabot


Take this simple case:
{code:java}
CamelContext ctx = new DefaultCamelContext();
ctx.addRoutes(new RouteBuilder() {
    @Override
    public void configure() throws Exception {
        from("direct:input")
            .doTry()
            .throwException(new Exception("Something wrong"))
            .doCatch(Exception.class)
            .end()
            .to("log:error?level=WARN&showCaughtException=true");
    }
});
ctx.start();
ctx.createProducerTemplate().sendBody("direct:input", null);
{code}

In Camel 2.x (tested with 2.24.1 and 2.25.1), we get the expected log:
{noformat}
13:58:06,685 | WARN  | main             | error                            | 
Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null], 
CaughtExceptionType: java.lang.Exception, CaughtExceptionMessage: Something 
wrong]
{noformat}
But in Camel 3.x (tested with 3.0.0, 3.1.0 and 3.2.0), the caught exception is 
not shown:
{noformat}
13:55:19,904 | WARN  | main             | error                            | 
Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null]]
{noformat}
However, with {{showAll=true}}, the caught exception is correctly shown:
{noformat}
13:58:41,258 | WARN  | main             | error                            | 
Exchange[Id: ID-EBEBRPCLDV0019-1588420721258-0-1, ExchangePattern: InOnly, 
Properties: {CamelExceptionCaught=java.lang.Exception: Something wrong, 
CamelToEndpoint=log://error?level=WARN&showAll=true}, Headers: {}, BodyType: 
null, Body: [Body is null], CaughtExceptionType: java.lang.Exception, 
CaughtExceptionMessage: Something wrong, StackTrace: java.lang.Exception: 
Something wrong
        at LogTest$1.configure(LogTest.java:16)
        [...]
{noformat}

I went through the different migration guides but couldn't find anything about 
this.

This is really blocking for our Camel 3.x migration; any workaround is welcome! 
(preferably through endpoint parameters)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to