title: Multiple SLF4J bindings with Play 2.3.8
body: <p>I use Play Framework 2.3.8 (for Java) with Scala 2.11.</p>
  
  <p>I get this warning:</p>
  
  <blockquote>
    <p>SLF4J: Class path contains multiple SLF4J bindings.<br>
    SLF4J: Found binding in [jar:file:/Users/vdanylchuk/.ivy2/cache/org.slf4j/slf4j-simple/jars/slf4j-simple-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]<br>
    SLF4J: Found binding in [jar:file:/Users/vdanylchuk/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]<br>
    SLF4J: See <a href="http://www.slf4j.org/codes.html#multiple_bindings" rel="nofollow noreferrer">http://www.slf4j.org/codes.html#multiple_bindings</a> for an explanation.</p>
  </blockquote>
  
  <p>This causes real problems at run time in a random way. On some of the deployed hosts, all goes well and the logs are written as configured. On the other hosts, the wrong binding wins, and the logs are written in the wrong location. The deployment process is scripted and exactly the same. So the warning at <a href="http://www.slf4j.org/codes.html#multiple_bindings" rel="nofollow noreferrer">http://www.slf4j.org/codes.html#multiple_bindings</a> is correct, and this is random, so I need to remove the extra binding.</p>
  
  <p>The fun thing is, they both come from the Play framework. logback-classic (which I actually want to use) comes from the play library, and slf4j-simple comes from the play sbt plugin.</p>
  
  <p>I read a lot of similar questions here and in the mailing lists. Example:
  <a href="https://stackoverflow.com/questions/25208943/how-to-fix-slf4j-class-path-contains-multiple-slf4j-bindings-at-startup-of-pl">How to fix &quot;SLF4J: Class path contains multiple SLF4J bindings&quot; at startup of Play 2.3.x?</a>
  The common solution is to use some form of exclude rules. None of the suggested solutions worked for me. [Update: in fact, they do - see the solution below.] I would not expect slf4j-simple to come up in the final classpath, but it does. Even though I added excludeAll(ExclusionRule(organization = "org.slf4j")) to every single dependency in my project, except the play framework.</p>
  
  <p>Any ideas on how to get rid of slf4j-simple? Preferably on sbt project level, without manually cleaning up the classpath of the build result.</p>
  
  <p><strong>Update: instructions to reproduce</strong>
  <p>I have narrowed it down with a small test project. Turns out it is triggered by a combination of play sbt plugin and the aether-deploy plugin that we use. It is sufficient to have this small configuration.
  <br>build.sbt:</p>
  
  <pre><code>name := "slf4j-test"
  version := "1.0"
  scalaVersion := "2.11.5"
  lazy val root = (project in file(".")).enablePlugins(PlayJava)
  </code></pre>
  
  <p><br>project/plugins.sbt:</p>
  
  <pre><code>resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
  addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.8")
  addSbtPlugin("no.arktekk.sbt" % "aether-deploy" % "0.13")
  </code></pre>
  
  <p><br>project/build.properties:</p>
  
  <pre><code>sbt.version=0.13.7
  </code></pre>
  
  <p>Then just run "sbt test:compile" or "sbt run" (and query localhost:9000) to see the warning. It works the same with scala 2.10.</p>