[slf4j-user] What about NDC in slf4j ?

Ceki Gülcü listid at qos.ch
Wed Feb 15 11:21:30 CET 2006


At 03:49 PM 2/14/2006, Franck Routier wrote:
>Hi,
>
>I am currently evaluating the oportunity to switch from log4j to slf4j
>in my app.
>
>I can find no mention of NDC in slf4j. How is this kind of
>functionnality supposed to be handled in slf4j ?


Good question. As Boris mentioned, SLF4J strives to be a simple facade
for various logging APIs so that you can easily switch between
them. In terms of the number of methods offered, SLF4J's API covers
only a very small portion of functionality that a serious logging
library has to offer. However, in terms of statements invoking the
logging system, SLF4J covers 98% of the total number of interactions
the developer has with the typical logging system.

As for MDC or NDC support, these are *not* covered by SLF4J. Note that
the total number of NDC/MDC statements in an application is several
orders of magnitude smaller when compared to logger.debug, logger.info
type interactions. Moreover, MDC/NDC interactions are less used in the
context of utility libraries.

Thus, in addition to the 3 options that Boris outlines, there is a
fourth option. You could use SLF4J with log4j underneath. Your log
statements would depend on SLF4J and MDC/NDC calls on log4j. In the
future, when you decide that you would like to switch a more powerful
logging system. In that case, you would just drop in the appropriate
jar files on your class path. For the numerically small MDC/NDC
statements you would perform the switch manually.

Admittedly, the above proposal is not perfect but it would
nevertheless significantly mitigate of the pain of switching.

I hope this answers your question,

>Thanks,
>
>Franck

-- 
Ceki Gülcü




More information about the slf4j-user mailing list