Fork me on GitHub
#pedestal
<
2022-11-03
>
orestis04:11:41

Am I not seeing something - pedestal/log has a facility to add data to MDC, but it's only exposed via macros, which are not really handy when working with interceptors. I ended up just using log4j2 ThreadContext which is the same thing, but I'm curious...

orestis04:11:17

That is, I want to set a value during an interceptor :enter and clear everything out at the last interceptor.

hlship21:11:38

That may be problematic if the interceptor is part of an async operation.

hlship21:11:55

As the thread executing code within the async chain may vary.

orestis09:11:17

Yes, I’m aware of that. We mostly use futures in our code but I’m not sure if they propagate Thread locals too.

orestis09:11:17

Obviously in async operations all bets are off but we’re not using them - the alternative there is manually keeping track of a log context