You have to be very careful that non-static registrars initialize the way that makes your code snippet in Serializable classes.
Firstly, because Log not serializable, so any attempt to serialize your class will not work either. If you declare your transient logger, then, as is logical, your Log field will not be initialized after deserialization, so you will get NPE when you try to write material. Not a good situation.
So, to summarize, you can have non-static loggers if you want, but make sure they are initialized before they are used. But other than that, I wouldn't worry about non-static loggers, most logging implementations will always return the same log object anyway (log4j definitely does).
biziclop
source share