If you know what information you want to keep and what you want to discard, then you should be able use MDC.getCopyOfContextMap() and MDC.setContextMapValues()
to clean up the MDC. But you’ll need to figure out when to call them based on the API that the thread-pool exposes to you.
From: Logback-user [mailto:logback-user-bounces@qos.ch]
On Behalf Of White, Joshua A A6IT
Sent: Monday, August 31, 2015 5:21 PM
To: logback-user@qos.ch
Subject: [logback-user] Any way to turn off MDC inheritance?
Hello,
I am using logback version 1.1.3. I have a situation where the MDC is getting copied over to thread pools that I don’t manage and filling my logs with log statements
that contain MDC information that is no longer valid. Because I don’t manage these thread pools, I am not able to copy the correct values to that thread pool when threads get used/re-used).
Does anyone have a solution for this problem?
-Joshua
------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: If you have received this email in error,
please immediately notify the sender by e-mail at the address shown.
This email transmission may contain confidential information. This
information is intended only for the use of the individual(s) or entity to
whom it is intended even if addressed incorrectly. Please delete it from
your files if you are not the intended recipient. Thank you for your
compliance. Copyright (c) 2015 Cigna
==============================================================================
------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: If you have received this email in error,
please immediately notify the sender by e-mail at the address shown.
This email transmission may contain confidential information. This
information is intended only for the use of the individual(s) or entity to
whom it is intended even if addressed incorrectly. Please delete it from
your files if you are not the intended recipient. Thank you for your
compliance. Copyright (c) 2015 Cigna
==============================================================================