[slf4j-dev] Transactions in slf4j?
Joern Huxhorn
jhuxhorn at googlemail.com
Mon Jun 1 21:44:08 CEST 2009
On 01.06.2009, at 21:30, Ceki Gulcu wrote:
>
>
> Thorbjoern Ravn Andersen wrote:
>>> I think that would be one of those use cases for an NDC... see http://apps.sourceforge.net/trac/lilith/wiki/NestedDiagnosticContext
> >
>> Interesting. But does anything actually happen when the push and
>> pops are executed?
>
> You can emulate NDC using MDC. Anyway, assume NDC existed, how would
> you do whatever it is you want to do?
>
I'd push a message containing info about the transaction at the start
and pop when it's done. This handles nested transactions quite well.
After the discussion here http://www.nabble.com/Why-is-there-no-NDC--td21596084.html#a21596084
I implemented an "NDC on steroids" for Lilith myself - as you
suggested.
It will only be evaluated by Lilith and my lilith-appenders, though,
so it's probably of limited use.
It's contained in the following maven dependency:
<groupId>de.huxhorn.lilith</groupId>
<artifactId>de.huxhorn.lilith.logback.classic</artifactId>
I'm not happy with this solution as I'd really prefer to add it to
SLF4J.
See http://apps.sourceforge.net/trac/lilith/browser/trunk/logback/classic/src/main/java/de/huxhorn/lilith/logback/classic/NDC.java
for the class that users would interact with.
Regards,
Joern.
More information about the slf4j-dev
mailing list