[logback-dev] Least-effort logging with bytecode modification

Ceki Gulcu listid at qos.ch
Tue Nov 18 19:43:05 CET 2008

Just chipping in.

Thorbjørn Ravn Andersen wrote:
>> 3) loggers named after the class and method / field name, so you can be more fine grained 
 >> in what output you get

> Actually this is something I've noticed that java.util.logging can do - 
> determine the method name of the caller - without any help.  Perhaps 
> this should be the approach?  Let the logger do it?

Log4j can also determine the caller as can logback. Logback can also determine 
and print the caller of the caller, or the caller of the caller of the caller. 
See http://logback.qos.ch/manual/layouts.html#ClassicPatternLayout and then 
search for the "caller" conversion word. The caller converter can be instructed 
to print the caller only when certain criteria are met as specified by an 

However, printing caller information is different than naming loggers after the 
method as Robert described in his email.

>> 4) passing the stacktrace to the output (depending on how you configure the pattern) 
>> so that if you are interested in what it was that changed the field or called the  
 >> method you don't need trace logging on for the entire application

I think the caller converter mentioned above already does what you want.

Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.

More information about the logback-dev mailing list