[ 
https://issues.apache.org/jira/browse/CAMEL-17514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17488131#comment-17488131
 ] 

Gijsbert van den Brink commented on CAMEL-17514:
------------------------------------------------

Hello [~davsclaus], I'm running into this issue as well, but the fix applied to 
3.14.1 and 3.15.0 doesn't work for me. All MDC values are missing in the actual 
log output, the camel values (like breadcrumbId and routeId), but also values I 
add from my own code. I had to revert back to 3.11.5 to get it working again.

> BreadcrumbId MDC Value not set even MDCLogging is true during ErrorHandling 
> Processor
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-17514
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17514
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 3.13.0, 3.14.0
>            Reporter: Michael Rambichler
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.14.1, 3.15.0
>
>
> *Expected Behaviour:*
> If UseMDCLogging=true and UseBreadcrumb=true is set then i expect then 
> everywhere the MDC Value camel.breadcrumbId is set.
> like it works in Camel Version < 3.12
> *Reproducable* 
> *Camel Version > 3.11*
>  
> Hint: If I use a custom UnitOfWorkFactory it works as expected. But I would 
> assume that If MDCLogging is enabled then the DefaultUnitOfWork would handle 
> this.
>  
> *Log without MDC camel.Breadcrumb:*
> 2022-01-19 12:01:00,335 INFO  [1 - timer://foo] route1                        
>            [route1 0141fbc5-bb47-4458-a982-1e6585109b8a] - Received exchange 
> with breadcrumbID: 0141fbc5-bb47-4458-a982-1e6585109b8a
> 2022-01-19 12:01:00,337 INFO  [1 - timer://foo] 
> c.t.a.r.h.HelloBreadcrumbRoute           [route1 
> 0141fbc5-bb47-4458-a982-1e6585109b8a] - Process with bug
> 2022-01-19 12:01:00,338 INFO  [1 - timer://foo] 
> c.t.a.r.h.OnExceptionProcessor           
> [{color:#FF0000}****breadcrumbMissing****{color}] - Some OnException process
> 2022-01-19 12:01:00,344 INFO  [1 - timer://foo] route2                        
>            [route2 {color:#FF0000}****breadcrumbMissing****{color}] - 
> Deadletter receive
>  
> *Example:*
> @Override
> public void configure() throws Exception {
>    getContext().setUseMDCLogging(true);
>    getContext().setUseBreadcrumb(true);
>    DeadLetterChannelBuilder errorHandlerBuilder = new 
> DeadLetterChannelBuilder();
>    errorHandlerBuilder.setDeadLetterUri("direct:deadletterTest");
>    errorHandlerBuilder.setOnExceptionOccurred(onExceptionProcessor);
>    errorHandler(errorHandlerBuilder);
>    from("timer://foo?fixedRate=true&period=10000")
>       .log("Received exchange with breadcrumbID: ${in.headers.breadcrumbId}")
>       .process(exchange -> {
>           throw new Exception("Some Bug");
>       });
>    from("direct:deadletterTest")
>       .log("Deadletter received ${body}");
>    }
>  
> *OnExceptionProcessor:*
> @Component
> public class OnExceptionProcessor implements Processor {
>    private static final Logger LOG = 
> LoggerFactory.getLogger(OnExceptionProcessor.class);
>    @Override
>    public void process(Exchange exchange) throws Exception {
>       LOG.info("Some OnException process");
>    }
> }
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to