TurboManage

David Chandler's Journal of Java Web and Mobile Development

  • David M. Chandler


    Web app developer since 1994 and Google Cloud Platform Instructor now residing in Colorado. Besides tech, I enjoy landscape photography and share my work at ColoradoPhoto.gallery.

  • Subscribe

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 223 other followers

  • Sleepless Nights…

    March 2010
    S M T W T F S
     123456
    78910111213
    14151617181920
    21222324252627
    28293031  
  • Blog Stats

    • 1,029,259 hits

Archive for March 12th, 2010

Coding getLogger() quickly with an Eclipse template

Posted by David Chandler on March 12, 2010

The AppEngine admin console log viewer is so powerful that it makes me want to log anything and everything. One obstacle to this (however minor) is that it’s a pain to write this for every class in which I want to log:

private static final Logger LOG = Logger.getLogger(MyLongClassName.class.getName());

Eclipse code templates to the rescue! Open Window | Preferences | Java | Editor | Templates and create a new template. Name it “log”, set the context to “Java type members”, and enter this pattern:

private static final Logger LOG = Logger.getLogger(${enclosing_type}.class.getName());
${imp:import(java.util.logging.Logger)}${cursor}

Click OK to save it. Now open any class in the editor, and type “log” followed by Ctrl-Space. Press Enter. Presto!

I feel a template for AsyncCallbacks coming on…

Posted in Eclipse | 3 Comments »

 
%d bloggers like this: