[slf4j-dev] Transactions in slf4j?
Ceki Gulcu
ceki at qos.ch
Wed Jun 3 11:34:17 CEST 2009
Thorbjoern Ravn Andersen wrote:
> Ceki Gulcu skrev:
>>
>>
>> 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");
>> }
> Ok. If I understand this correctly, it still needs additional logback
> configuration to map the above to snippets calling the appropriate
> methods hooking into the native logging system?
Indeed. The sample code above above illustrates the use of markers to
mark the beginning and the end of a transaction via the SLF4J API. You
would then need to do something with that information using the
logback API. It could be using a TurboFilter, a regular filter, an
appender or something entirely different.
What is it that you would like to achieve?
--
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