title: Akka & SLF4J Configuration
body: <p>I read the <a href="http://doc.akka.io/docs/akka/snapshot/java/logging.html#SLF4J" rel="nofollow">Akka Logging tutorial</a> and am still a bit confused as to how to get Akka working with SLF4J. I my <em>understanding</em> is correct, the general process is:</p>
  
  <ol>
  <li>Include the <code>akka-slf4j</code> module on the runtime classpath, which transitively pulls in <code>slf4j-api</code></li>
  <li>Include an SLF4J backend on the runtime classpath, such as Logback</li>
  <li>Configure the logging backend (somehow, see below)</li>
  <li>Instantiate and use SLF4J loggers like normal</li>
  </ol>
  
  <p>So first, if I have missed or misunderstood <em>any</em> of the steps above, please begin by correcting me! Assuming I'm more or less correct, I'm still completely clueless on two items:</p>
  
  <ul>
  <li>Do I configure Akka or do I configure the SLf4J "backend" (binding)? (see below)</li>
  <li>Why don't I instantiate SLF4J loggers like normal? (see below)</li>
  </ul>
  
  <h3>Configuration</h3>
  
  <p>If I were normally using SLF4J/Logback, I would just make sure that there was a <code>logback.xml</code> file on the runtime classpath. Or if I was using <code>slf4j-simple</code> I would make sure there was an <code>slf4j.properties</code> file on the runtime classpath. But with Akka, it seems that I either need to declare an <code>akka.loggers</code> section like so:</p>
  
  <pre><code>akka {
      loggers = ["akka.event.slf4j.Slf4jLogger"]
      loglevel = "DEBUG"
      logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
  }
  </code></pre>
  
  <p>...and/or configure the SLF4J binding like I normally do. <strong>So which is it?</strong></p>
  
  <h3>Logger Instantiation</h3>
  
  <p>I don't understand why you don't instantiate SL4J loggers like normal. <em>Normally</em>, outside of an actor/actor system, my logger instantiation would look like this:</p>
  
  <pre><code>public class FizzBuzz {
      Logger logger = Logger.getLogger(FizzBuzz.class);
  
      // ...etc.
  }
  </code></pre>
  
  <p>But in the Akka docs, it seems I have to instantiate them like this:</p>
  
  <pre><code>public class FizzBuzz {
      LoggingAdapter log = Logging.getLogger(system.eventStream(), "my.string");
  
      // ...etc.
  }
  </code></pre>
  
  <p><strong>Why?!?!</strong></p>
  
  <p>Also, bonus points if anyone can explain to me the use/purpose of "MDC values" (???) and the <code>DiagnosticLoggingAdapter</code>.</p>