[slf4j-dev] [Bug 163] Copy & paste of LoggerFactory.getLogger

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Tue Dec 15 20:30:42 CET 2009


http://bugzilla.slf4j.org/show_bug.cgi?id=163





--- Comment #23 from Thomas Mueller <thomas.tom.mueller at gmail.com>  2009-12-15 20:30:42 ---
> @Logger
> private final Logger logger;
> would be able to initialize logger appropriately?

Yes. In Java 6 that's possible. You don't even need the second line:
http://code.google.com/p/morbok/
(I already posted that link in the description).

You might want to integrate something like Morbok in SLF4J.

This is not a hack at all by the way. 
A similar technique is used in the JPA 2.0 API:
http://blogs.sun.com/ldemichiel/entry/java_persistence_2_0_proposed
(Metamodel API)

> Basically annotations are metadata, so you need SOMETHING 
> that will do something with it for this to happen.  
> A normal classloader will NOT.

No, a classloader will not, but the annotation processor will.
This is integrated in Java 6:
http://www.javabeat.net/articles/14-java-60-features-part-2-pluggable-annotation-proce-1.html

> LoggerFactory.getEnclosingLogger(new Object(){})
> too much of a hack to be publicly endorsed

I of agree. Specially with the 500 byte overhead.


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the slf4j-dev mailing list