[slf4j-dev] BasicMDCAdapter

Ceki Gülcü ceki at qos.ch
Sat Mar 6 14:27:50 CET 2010


On 22/01/2010 11:20 AM, Gunnar Wagenknecht wrote:
> Hi,
>
> I noticed that the BasicMDCAdapter uses a regular InheritableThreadLocal
> while the LogbackMDCAdapter uses a custom "CopyOnInheritThreadLocal".
> The JavaDoc implies that they should be similar. Any reasons why the
> difference in implementation was chosen (perhaps performance, memory)?

Having children thread inherit a copy of the mdc map seems like the correct 
thing to do. I don't remember why BasicMDCAdapter does not do the same.

> Also BasicMDCAdapter seems to require Java 5 although it's part of the
> SLF4J API library. It calls ThreadLocal#remove() directly (without
> reflection) which does not exists in JDK<= 1.4.

You are right. Interestingly enough, no one has complained about this omission. 
Either no one is using org.slf4j.MDC under JDK 1.4 or those who run into 
problems do not care enough to complain.

> -Gunnar
>



More information about the slf4j-dev mailing list