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





--- Comment #8 from Thomas Mueller <[email protected]>  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.
_______________________________________________
slf4j-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/slf4j-dev

Reply via email to