[slf4j-dev] Transactions in slf4j?

Ceki Gulcu ceki at qos.ch
Mon Jun 1 21:45:46 CEST 2009



Here is a idea:

Marker TX_BEGIN = MarkerFactory.getMarker("TX_BEGIN");
Marker TX_END= MarkerFactory.getMarker("TX_END");

try {
   logger.info(TX_BEGIN, "beginning tx");
   doSomething();
} finally {
   logger.info(TX_END, "ending tx");
}


Thorbjoern Ravn Andersen wrote:
> Ceki Gulcu skrev:
>>
>>
>> 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 don't know.  I'm asking.
> 
> The question is, can I somehow issue transaction "delimiters" in the 
> logging system allowing me to "group" a set of logging statements.  This 
> is possible in the AS/400 collection service logging framework which is 
> why I posed the question about how I could map these "begin" - "end" 
> statements to the slf4j API
> 
> 
> 

-- 
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