Eclipse Template for inserting Log4j Logger
Tired addingprivate static final Logger logger = Logger.getLogger(XXX.class);
by hand to your Java classes?Use Eclipse templates! Navigate to Windows -> Preferences -> Java -> Editor -> Templates. And add following new template to the Java context:
private static final Logger logger = Logger.getLogger(${enclosing_type}.class); ${:import(org.apache.log4j.Logger)}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:
No comments:
Post a Comment