Sunday, August 2, 2009

Log4j Eclipse Code Template


If you are tired of manualy adding static logger instances in classes, try this template ...
Under Preferences > Java > Editor > Templates:
  1. Click new.
  2. Give it a description and name.
  3. Use this Pattern:
${:import(org.apache.log4j.Logger)}
private static final Logger LOG = Logger.getLogger(${enclosing_type}.class);



To apply it, type the template name and press ctrl + space.


No comments:

Post a Comment