[slf4j-user] Re: slf4j JDK - does not show the class andmethod that invokes the logger
peter royal
peter.royal at pobox.com
Tue Nov 29 18:15:25 CET 2005
Ceki Gülcü <listid <at> qos.ch> writes:
> Unfortunately, contrary to log4j, the JDK 1.4 API does not allow the
> wrapper class, in this case SLF4J, to specify that the caller is one level
> higher. Commons-logging circumvents this limitation by creating an
> exception, parsing it and passing the information to JDK 1.4. However, this
> approach can have quite a severe performance impact, which is why SLF4J did
> not adopt the same approach.
Looking at the LogRecord code (at least in Java 5), this is what it does
internally to infer the caller.
However, the JDK 1.4 API does allow this. Use Logger.log( LogRecord ), and you
can call LogRecord.setSourceClassName() and LogRecord.setSourceMethodName()
to explicitly set the classs/method.
-peter
More information about the slf4j-user
mailing list