CodeNarc web console

subscribe to the feed Subscribe
to this
site
embed in your blog Embed
this
script
Sloppy Logging (via #meetcodenarc)
tweet this snippet Tweet
this
script

To embed this script in your site, just drop the content below where you want to embed it.

Sloppy Logging

Published 2 years ago by HamletDRC with tags quiz
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
@SuppressWarnings('StatelessClass')
class MyClass {

    private static final LOG = Logger.getLogger(Class)
    private logger = Logger.getLogger(MyClass)

    def action = {
        try {
            logger.info(it)
        } catch (IOException e) {
            LOG.error(e)
        }
    }
}

Recent scripts