Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14999

Camel 3 log showCaughtException is not working

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.0.0, 3.1.0, 3.2.0
    • 3.3.0
    • None
    • None
    • Unknown

    Description

      Take this simple case:

      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);
      

      In Camel 2.x (tested with 2.24.1 and 2.25.1), we get the expected log:

      13:58:06,685 | WARN  | main             | error                            | Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null], CaughtExceptionType: java.lang.Exception, CaughtExceptionMessage: Something wrong]
      

      But in Camel 3.x (tested with 3.0.0, 3.1.0 and 3.2.0), the caught exception is not shown:

      13:55:19,904 | WARN  | main             | error                            | Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null]]
      

      However, with showAll=true, the caught exception is correctly shown:

      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)
      	[...]
      

      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)

      Attachments

        Activity

          People

            bedla Jan Bednar
            laurentchabot Laurent Chabot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: