Every class that wants to use java.util.logging generally needs to declare a logger like this:
public class MyClass { private static Logger _log = Logger.getLogger(MyClass.class.getName()); }
How do you avoid this MyClass.class.getName() boilerplate code?
I have a template set up in Eclipse so that I only have to type a portion of the declaration, and then Eclipse will auto-complete the rest for me.
So, I only have to type
logger, hitCtrl+Space, followed byEnter, and Eclipse fills in the rest for me and adds the import declaration as well.This won’t cut down on the amount of boilerplate code, but at least it cuts down on the amount of keystrokes.