Thank you for your explanation. It's almost the same I had thought of myself but I appreciate being approved (thank you for your sample); it's improves self confidence. Thank you for the hint making it static - this fixed it. 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.
brgds, Ulrich > Robert Elliot <[email protected]> hat am 6. Juni 2013 um 18:33 geschrieben: > > > Loggers do not need to be static, and there's no particular reason why they > would be beyond normal reasons why you might make a variable static. Though in > this case making them static would fix the problem. > > Ulrich - inherently your problem has nothing to do with SLF4J, it's a pure > Java bug in your code. The first thing the constructor of a sub class does is > call the constructor on the super class. It will do this before initialising > any fields defined in the subclass. If you call an over-ridden method in the > constructor of the super class which uses a field on the sub-class, it will be > uninitialised. > ..snip.. _______________________________________________ slf4j-user mailing list [email protected] http://mailman.qos.ch/mailman/listinfo/slf4j-user
