java - logging static methods in a parent class - Stack Overflow
Best practice is to declare LOGGER static, e.g.
protected final static Logger LOGGER = Logger.getLogger(getClass());
This way you can use LOGGER from dynamic and static methods.
Also each class should have its own instance of the logger. So I would change protected to private.
ALSO, instead of calling "getClass()" you should call "MyApp.class", e.g.
private final static Logger LOGGER = Logger.getLogger(MyApp.class);
Read full article from java - logging static methods in a parent class - Stack Overflow
No comments:
Post a Comment