[slf4j-dev] Transactions in slf4j?

Ralph Goers rgoers at apache.org
Tue Jun 2 01:52:04 CEST 2009


We have a class called RequestContext. All it contains is a bunch of  
constants and static helper methods to store fields into the MDC. At  
the start of every request we call RequestContext.initialize(). That  
clears the MDC and then adds a key named "id" that contains a  
java.util.UUID as a String. The "RequestContext" is then passed  
throughout the application and is even serialized and passed to remote  
systems so that the distributed request can be captured and aggregated  
in logs.

Is this what you are after?

On Jun 1, 2009, at 12:40 PM, 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
>
>
>
> -- 
> Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"
>
> _______________________________________________
> dev mailing list
> dev at slf4j.org
> http://www.slf4j.org/mailman/listinfo/dev




More information about the slf4j-dev mailing list