Generate log line with Intellij and live templates

With IntelliJ, one missing feature is the automatic generation of the famous private static Logger LOGGER = ...; You can do it easily with the Live Templates, you just have to go to Editor -> Live Templates -> others -> create new And in these fields : Abbreviation: log Description: Add log line Template text: private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger($CLASS_NAME$.class); Applicable in: Java: declaration Edit variables: CLASS_NAME Expresion: className() Make sure you have slf4j-api in your classpath, with maven: ...

March 1, 2015 · 1 min