[slf4j-user] Logger in subclass in NULL

Toolforger toolforger at durchholz.org
Fri Jun 7 08:54:16 CEST 2013

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 
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.

More information about the slf4j-user mailing list