[slf4j-dev] svn commit: r1155 - in slf4j/trunk/slf4j-ext/src/main/java/org/slf4j: agent instrumentation

Ceki Gulcu listid at qos.ch
Thu Oct 2 21:15:07 CEST 2008



Thorbjørn Ravn Andersen wrote:
> Ralph Goers skrev:
>> Thanks,
>>
>> I'm quite interested in this, but not only for entering and exiting but 
>> eventually for other logging as well.  However,  I wouldn't want it in 
>> all classes. I'd prefer to see additional configuration to define which 
>> classes should be instrumented.
>>   
> You are welcome.
> 
> Basically, all this does is inserting a "if (_log.isDebugEnabled()) 
> _log.debug("entering XXX with arguments Y=..., Z=....")" and a 
> corresponding exit logger to each method. It _IS_ simple and I do not 
> want to build it to be some large instrumentation framework.    It is 
> just to allow people to very easily get extra information - a quick win 
> - without having to do a lot of stuff.

Does _log field refers to a logger named after the containing class? If so, you 
could enable/disable logging for each java class separately using the 
configuration mechanism provided in log4j/jul/logback. In other words, 
additional configuration in the agent is *unnecessary*. Is that nice or what?

The only problem with this approach is that you would be enabling/disabling 
logging for the entire class. Had you used markers, one could enable/disable 
entry/exit logging without necessarily affecting logging in the rest of the 
containing class. By the way, XLogger.enter() and exit() methods use the 
appropriate markers.

I'd also like to point that XLogger.enter and exit() method use the TRACE level 
whereas LogTransformer uses DEBUG. A little consistency is in oder... Either 
both use TRACE or both should use DEBUG.

Cheers,

 > [snip]

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