[slf4j-dev] org.slf4j.NDC implementation problem

Ceki Gulcu ceki at qos.ch
Tue Nov 22 07:36:12 CET 2011


Hi Antony,

Could you please enter a bug report so that when the patch is applied it 
can be associated with a bug number?

--
Ceki


On 22.11.2011 04:59, Antony Bowesman wrote:
> I'm migrating a log4j environment to SLF4J.  Our log4j usage makes use
> of NDC as a small stack and I'm using the ext package to use the slf4j NDC.
>
> However, the problem is that the NDC implementation just sits on top of
> MDC and the MDC context is inherited by threads, whereas NDC is NOT,
> unless inherit() is called specifically.
>
> I then went to patch my NDC usage to call NDC.clear(), but the
> org.slf4j.NDC does not expose it.
>
> This means the log output contains the NDC context from my root thread
> and there's no way to clear any of the context.
>
> So, I have patched NDC as attached. a
>
> Is there any reason why this cannot be taken to the core code?
> Antony
>
>


More information about the slf4j-dev mailing list