Obtain SagaId so that it can be added to logger's MDC

Need help to find the appropriate place within saga lifecycle to set a loggers MDC with SAGA id, for easier debugging purposes. This should be done generically (once-off) Hopefully there’s an existing “hook” or interceptor I’m unaware of which can be used for purpose above.

Any help appreciated!

Hi Dylan,

I’ll have to take you down to the caverns of Axon here. Bear with me. :slight_smile:

You can configure a MessageHandlerEnhancer that reacts to @SagaEventHandler methods. You can intercept the invocations done by Axon and set MDC data there. Axon has a few examples, including one that intercepts based on @SagaEventHandler to implement Saga specific behavior for handlers.

Hope this helps.