title: Where to define a static application-wide logger?
body: <p>I have a number of packages in my Java web application. In some of them I use this construct:</p>
  
  <pre><code>public class Foo {
    private static Logger logger = LoggerFactory.getLogger("com.XXX");
    public void bar() {
      Foo.logger.debug("Method bar() was just called");
    }
  }
  </code></pre>
  
  <p>Of course, it's just an example. Everything works fine, but I don't like the idea of logger initialization in many classes. It's an obvious code duplication. I would like to move it to some helper class and let all other classes access it. Is it a correct idea? Or maybe there is some other "best practice" or a pattern?</p>