How to set up Eclipse template for inserting Log4j Logger
Tired adding private static final Logger logger = Logger.getLogger(XXX.class);
by hand to your Java classes?
Use Eclipse templates instead. Navigate to Windows -> Preferences -> Java -> Editor -> Templates. And add following new template to the Java context:
Finally, this should look as follows:
Now, if you are in the Java context, then type "logger" followed by "Ctrl+space". You are invited to choose from different templates including your template entered above:
After choosing the template, you ending up with an added logger plus the corresponding Java import:
Original post: http://peter-on-java.blogspot.com/2012/06/eclipse-template-for-inserting-log4j.html