title: What's the overhead of creating a SLF4J loggers in static vs. non-static contexts?
body: <p>I've always used the following pattern to construct (SLF4J) loggers:</p>
  
  <pre><code>private static final Logger log = LoggerFactory.getLogger(MyClass.class);
  </code></pre>
  
  <p>This has worked so far, but I was wondering about the <code>static</code> context at some point and the need to pass in the concrete class literal all the time instead of just using a non-static logger like</p>
  
  <pre><code>private final Logger log = LoggerFactory.getLogger(getClass());
  </code></pre>
  
  <p>This has basically been asked (and answered) before here for LOG4J</p>
  
  <p><a href="https://stackoverflow.com/questions/3842823/should-logger-be-private-static-or-not">Should logger be private static or not</a></p>
  
  <p>and here</p>
  
  <p><a href="https://stackoverflow.com/questions/7324386/should-be-logger-always-final-and-static">Should be logger always final and static?</a></p>
  
  <p>I realize <code>final</code> is basically mandatory, so I'm left wondering how high the overhead of using SLF4J's in non-static context actually is.</p>
  
  <p><strong>Q:</strong></p>
  
  <p>Is there any <strong>significant practical</strong> overhead of using</p>
  
  <pre><code>private final Logger log = LoggerFactory.getLogger(getClass());
  </code></pre>
  
  <p>over</p>
  
  <pre><code>private static final Logger log = LoggerFactory.getLogger(MyClass.class);
  </code></pre>
  
  <p>in the <strong>average</strong> (web) app? (no need to "discuss" high-end, heavy-load webapps here)</p>
  
  <hr>
  
  <p>Note, I'm ultimately planning to use an even nicer approach using CDI to obtain an SLF4J  logger like</p>
  
  <pre><code>@Inject private final Logger log;
  </code></pre>
  
  <p>as described here <a href="http://www.seamframework.org/Weld/PortableExtensionsPackage#H-TtLoggerttInjection" rel="noreferrer">http://www.seamframework.org/Weld/PortableExtensionsPackage#H-TtLoggerttInjection</a>, but I need to know about the logger caching first.</p>
  
  <p>Sub question: is it even possible to use?:</p>
  
  <pre><code>@Inject private static final Logger log;
  </code></pre>
  
  <p>(just beginning with CDI to be honest)</p>