Whether or not use checks like isInfoEnabled:
http://stackoverflow.com/questions/6504407/is-there-a-need-to-do-a-iflog-isdebugenabled-check Logging levels:
http://www.slf4j.org/api/org/apache/log4j/Level.html Via static member
IDEA template
Abbreviation: log
private static final Logger log = LoggerFactory.getLogger($CLASS$.class);$END$
Define $CLASS$ variable as className() in the Edit Variables dialog.Lazily initialized
IDEA template
Abbreviation: logl
private enum LogSingleton {
INSTANCE;
@SuppressWarnings("NonSerializableFieldInSerializableClass")
private final Logger value = LoggerFactory.getLogger($CLASS$.class);
}
private static Logger log() {
return LogSingleton.INSTANCE.value;
}$END$
Define $CLASS$ variable as className() in the Edit Variables dialog.
It is preferred to put the above code at the bottom of the corresponding class for better readability of the main code of the class.