[slf4j-dev] [Bug 163] Copy & paste of LoggerFactory.getLogger
bugzilla-daemon at pixie.qos.ch
bugzilla-daemon at pixie.qos.ch
Tue Dec 15 09:29:24 CET 2009
http://bugzilla.slf4j.org/show_bug.cgi?id=163
--- Comment #8 from Thomas Mueller <thomas.tom.mueller at gmail.com> 2009-12-15 09:29:24 ---
If you want to close this bug because there is no 'perfect' solution,
then that's OK with me. Here a small summary of the 'anonymous inner class'
workaround. Maybe integrating something like http://code.google.com/p/morbok/
would be better.
A)
LoggerFactory.getLogger(new Object(){}.getClass().getEnclosingClass());
Advantage:
- You can copy & paste it to new classes
Disadvantages:
- Looks a bit weird
- Adds 500 bytes for each logger
B)
LoggerFactory.getEnclosingLogger(new Object(){});
Advantage:
- You can copy & paste it to new classes
Disadvantages:
- Still looks weird, but less so (shorter than A)
- Adds 500 bytes for each logger
- Requires a new method in LoggerFactory
C)
interface L{};
LoggerFactory.getLogger(new L(){}.getClass().getEnclosingClass());
Advantage:
- You can copy & paste it to new classes
Disadvantages:
- Looks even more weird than A
- Pollutes the namespace with 'L'.
- Adds about 240 bytes for each logger
--
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