[slf4j-user] Why is there no NDC?

Ceki Gulcu ceki at qos.ch
Thu Jan 22 12:04:47 CET 2009


Hi Joern,

You are not beating a dead horse. There is no NDC in SLF4J because it is thought 
that the MDC offers a better more general solution than the NDC.

However, I don't understand what you mean when you write:
slf4j.NDC("Parameter is {}.", obj)

What does the NDC offer that the MDC does not? I mean from a users point of view.

Cheers,

Joern Huxhorn wrote:
> Hi.
> 
> I hope I'm not beating a dead horse but I just somewhat rediscovered the 
> log4j NDC class (I was using commons.logging before switching to slf4j) 
> and I was wondering why there is no NDC class defined in slf4j.
> 
> While the original NDC class could be improved it seems like a quite 
> nice addition to the MDC. I guess it would get especially interesting 
> with closures where you could write something like
> 
> (pseudo-code)
> slf4j.NDC("Parameter is {}.", obj)
> {
>     [the nested code]
> }
> 
> which would remove the necessity to pop the stack manually.
> 
> But even without closures an NDC implementation utilizing parameters 
> seems really worthwhile to me.
> 
> Just wondering,
> Joern.


-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the slf4j-user mailing list