-
-
Notifications
You must be signed in to change notification settings - Fork 989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDC Usage regression #388
Comments
Off the top of my head, the idea is to get a copy of the MDC map from the parent thread, pass it to the child thread and have the child thread insert it into the MDC programmatically. |
Doing it programmatically is an extreme solution, since it is an old project with millions of lines of code. I am looking for a solution that will avoid modifying the entire project. |
Which version of slf4j and logback are you upgrading from? |
I upgraded from logback 1.2.9 and slf4j 1.7.26. we made an adaptation to use the MdcAdapterReplacer like this |
Hello @pauljean |
it's just an adaptation, which allowed us to update the context. with the upgrade it no longer works. |
In more recent versions of logback, the See LogbackServiceProvider, lines 44 or so. |
Here is a test that allows to reproduce the problem. |
If you set <configuration debug="true"/> you will see this printed:
So it looks like the code prevents the mdcAdapter from being set anew. I have to think about relaxing this hurdle. |
we don't understand why you locked the code to prevent a new definition of the MDCAdapter. It will be very useful if you relax the definition of the MDCAdapter. thank you for keeping us informed Many thanks |
Hello,
Currently i'm using Slf4j version 2.0.11 and Logback version 1.4.14
I'm working on an old products with a lot of code and using a lot of thread, so I need to have MDC properties thread inheritance. So I force the usage of a BasicMDCAdapter by setting the MDC.mdcAdapter to new BasicMDCAdapter() when my program starts.
The problem is that, using Slf4j version 2.0.11 and Logback version 1.4.14 this doesn't work anymore.
I don't have any MDC info in my logs.
Could you please tell me what is the correct way to use your BasicMDCAdapter ? or tell me another way to have MDC properties thread inheritance ?
Many thanks
The text was updated successfully, but these errors were encountered: