Drawing Hands by M.C. Escher (1948)

Jeff Mesnil

Archive for March 1st, 2006


Logging templates for eclipse

On March 1st, 2006 in eclipse (No Comments »)

Following Wayne Beaton’s post on more templates with eclipse, here is an example of template that I extensively use in eclipse to ease logging statements. For each logging level (debug, info, warn, error, fatal), I defined a corresponding templates. For example, I have a debug template:

if (logger.isDebugEnabled()) {
   logger.debug(${cursor});
}

It makes it simpler and quicker to write logging statements. However the class won’t compile if a logger field has not already been defined. But in that case, either you can use eclipse’s quick fix… or create a new template to define the logger.