>>> The following logger declaration idiom is resistant to cut-and-pasting
>>> between classes. However, it assumes that the logger variable is an
>>> instance variable of the class.
>>>
>>> package some.package;
>>>
>>> import org.slf4j.Logger;
>>> import org.slf4j.LoggerFactory;
>>> public class MyClass {
>>> final Logger logger = LoggerFactory.getLogger(this.getClass());
>>> ... etc
>>> }
May I just state that this is very dangerous, and should not be
exemplified ever, in the event that people that don't understand quite
what it embodies may start to use it in the wrong scenario, WHICH IS
when the class in question is instantiated often. If this for example is
a helper-class instantiated per service call, the getLogger method will
become a HUGE synchronized bottleneck.
Endre.
_______________________________________________
user mailing list
[email protected]
http://www.slf4j.org/mailman/listinfo/user