[slf4j-dev] [Bug 163] Copy & paste of LoggerFactory.getLogger
bugzilla-daemon at pixie.qos.ch
bugzilla-daemon at pixie.qos.ch
Tue Dec 15 18:54:49 CET 2009
http://bugzilla.slf4j.org/show_bug.cgi?id=163
--- Comment #21 from Thorbjørn Ravn Andersen <thorbjoern at gmail.com> 2009-12-15 18:54:49 ---
(In reply to comment #20)
> I agree with Ceki.
> The getEnclosingLogger(..) syntax is quite strange.
>
> You could always use
> LoggerFactory.getLogger(new Object(){}.getClass().getEnclosingClass());
> as you said yourself.
Which is the finest example of cut-and-paste template I've seen for long :)
I do not fancy the anonymous class trick. I like the class name better, and
some day I'll make Eclipse do it for me. Right now I'm happily typing it every
time.
>
> Changing the topic a bit:
> Does anyone know enough about annotations to be able to tell me if something
> like
>
> @Logger
> private final Logger logger;
>
> would be able to initialize logger appropriately? I've never written an
> annotation myself so I don't know.
I looked into this a while back. Basically annotations are metadata, so you
need SOMETHING that will do something with it for this to happen. A normal
classloader will NOT.
I am at the moment trying to use Google Guice - which provides dependency
injection - and it has built in support for JUL.
http://code.google.com/p/google-guice/wiki/BuiltInBindings
--
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