[slf4j-dev] MDC Type functionality
Ceki Gülcü
listid at qos.ch
Mon Mar 26 20:51:38 CEST 2007
Paul,
Would it help if SLF4J implemented a facade for MDC? Both logback and log4j
1.3 (and above) implement MDC in the same way. Given lack of demand and
that compared to log requests there are much fewer MDC calls, we decided
not to include a facade for MDC in SLF4J. However, such support could be
included if there is interest from the user community.
Reading a recent thread in equinox dev [1], it looks like log service is
run from a different thread than the thread issuing the log request. I am
not sure how MDC support in SLF4J support could help you...
[1]
http://thread.gmane.org/gmane.comp.ide.eclipse.equinox.devel/1512/focus=1513
At 06:55 PM 3/26/2007, John E. Conlon wrote:
>Hello Paul,
>
>Have you considered using the
>
>
> org.slf4j.Marker
>
>to move this data to the readers? See the FAQ
>http://www.slf4j.org/faq.html#marker_interface
>
>BTW - You may have noticed in our slf4j source repository we have
>implemented a simple osgi log service for slf4j?
>http://svn.slf4j.org/viewvc/slf4j/trunk/osgi-over-slf4j/
>
>I have not worked with the Equinox log service but plan to do so soon.
>Paul would you be so kind to please provide a link to the documentation
>that can describe the Equinox extensions? Is this log service the same
>used by Eclipse as well?
>
>thanks,
>John
>
>
>Gardiner, Paul wrote:
> >
> > I have written an SLF4J binding to the Equinox extended log service,
> > which is an extension of the OSGi logging service, that includes
> > contextual information, and passes isLoggable statements through to
> > log listeners (readers). The problem I have is supporting extra data
> > that is not part of the log message. SLF4J does not include MDC or NDC
> > functionality, so I am not sure of the best way to pass through this
> > kind of data. A typical use case is session id, which is passed as
> > MDC. When the log entry is made, the session id is included in the
> > file appender, but omitted from an appender that sends pages. One
> > solution is to read all MDC data and pass it through to the OSGi log
> > service, and then recreate it in the log reader. However, I was
> > wondering if there was a more elegant/less expensive solution.
> >
> > Thanks,
> >
> > Paul
> >
> > ------------------------------------------------------------------------
> >
--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
More information about the slf4j-dev
mailing list