You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Twitter Futures allow swapping the slf4j MDC to use Local.scala which is a special context using a combination of ThreadLocal and swapping in/out context for thenCompose and thenApply. In this way, when a request comes in, I can MDC.put("userName", userName); and it will be available to all logging across all thenApply and thenCompose methods. Without this, logging in slf4j with MDC generally breaks down. With this fix, one can swap the MDC with a FutureLocal.java usage. Of course, the Futures will have to know about FutureLocal.java to make this happen.
The text was updated successfully, but these errors were encountered:
Please read the following section in docs:
"8. Context variables & contextual Promises"
The functionality will be altered in the upcoming release, but the idea will remain the same. So, in fact, it's possible to propagate ThreadLocals and alike contextual variables.
Twitter Futures allow swapping the slf4j MDC to use Local.scala which is a special context using a combination of ThreadLocal and swapping in/out context for thenCompose and thenApply. In this way, when a request comes in, I can MDC.put("userName", userName); and it will be available to all logging across all thenApply and thenCompose methods. Without this, logging in slf4j with MDC generally breaks down. With this fix, one can swap the MDC with a FutureLocal.java usage. Of course, the Futures will have to know about FutureLocal.java to make this happen.
The text was updated successfully, but these errors were encountered: