[slf4j-user] Logger in subclass in NULL

Ulrich Forums at gombers.de
Fri Jun 7 23:39:51 CEST 2013

Thanks, I will consider your idea.

Am 07.06.2013 um 08:54 schrieb Toolforger <toolforger at durchholz.org>:

> Am 07.06.2013 08:14, schrieb Ulrich:
>> I started using the
>> Logger as a static class but I like naming it dynamically (this.getClass()) -
>> it's a lot easier to maintain it. I sometimes move the classes from one package
>> to another or rename a package and I would need to change the name every time
>> then.
> For this very purpose, I built a static ClassTools.getClass() function that finds the caller's class name.
> Various methods to do so are discussed on http://stackoverflow.com/questions/421280/in-java-how-do-i-find-the-caller-of-a-method-using-stacktrace-or-reflection
> Forget the benchmark numbers though. He's calling functions in tight loops, which tends to get inlined - which is not going to happen on one-off class initialization code.
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user

More information about the slf4j-user mailing list