Blog About Contact

Netbeans code template for SLF4J logging

Published Mon, 29 Jul 2013

Here's a neat code template for Netbeans to add a static logger declaration to a class file.

private static final Logger log = 
    LoggerFactory.getLogger(${classVareditable="false" currClassName default="getClass()"}.class);

This can be added to a short-form (I use log) which you can then type log+Tab to expand to the full declaration customised to the current class file.

Here's where the settings are (from my other post on static imports) -

This is one of those things that I couldn't live without in the IDE as it removes so much annoying repetition!

About the Author

Richard Nichols is an Australian software engineer with a passion for making things.

Follow him on twitter or subscribe by RSS or email.

You might also enjoy reading -

Discuss / Comment

No one has commented yet.

Add a comment

  • {{e.error}}

Thanks for your comment!/

Valid email address required.
Posting message, please wait...