7

I have added in sbt a library dependency

"org.slf4j" % "slf4j-simple" % "1.7.12"

In order to solve:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

it does show up in the output of sbt show libraryDependencies:

[info] List(org.scala-lang:scala-library:2.11.7, com.typesafe.play:twirl-api:1.1.1, com.lihaoyi:utest:0.3.1, org.scala-lang:scala-compiler:2.11.7, com.typesafe.play:play-json:2.5.3, com.github.pathikrit:better-files:2.14.0, org.apache.commons:commons-math3:3.5, commons-io:commons-io:2.5, com.typesafe.play:play:2.5.3, com.typesafe.play:play-netty-server:2.5.3, com.typesafe.play:play-ws:2.5.3, com.thenewmotion.akka:akka-rabbitmq:2.3, org.slf4j:slf4j-simple:1.7.12)

However the problem persists. What might it be?

Also to mention that in the output of ps for the relevant process, slf4j-simple does not show.

Play 2.5 introduced logging changes, and I am using play as a library not as the framework plugin, so I have to mimic the required configuration ― where the NOP logging default shown at the top needs to be replaced to ensure proper logging. How may I get to the bottom of what's going on?

There are several similar questions which I have looked at, but they do not extrapolate to this question in any direct manner.

matanster
  • 15,072
  • 19
  • 88
  • 167
  • Possible duplicate of [SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"](http://stackoverflow.com/questions/7421612/slf4j-failed-to-load-class-org-slf4j-impl-staticloggerbinder) – marcospereira Jun 05 '16 at 01:11
  • There are several similar questions which I have looked at, but they do not extrapolate to this question in any direct manner. Also this question has some specific details to it which stand out. – matanster Jun 05 '16 at 10:57
  • 1
    I'm not very familiar with SBT or Scala, but it does sound like in your runtime classpath, the slf4j-simple jar isn't there even though you expect it to be. Perhaps it's there when compiled but not during runtime? –  Jun 09 '16 at 12:36
  • @matanster can you show us your XML config for the logging library? – wheaties Jun 13 '16 at 13:52

2 Answers2

1

Add this dependency to build.sbt. It worked for me:

libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"

More about logback : http://logback.qos.ch/

Saurav Sahu
  • 13,038
  • 6
  • 64
  • 79
0

Play is a sbt plugin, and this error may well happen in the plugin rather than in your application. Adding it to libraryDependencies in the application therefore won't solve it.

Instead try adding it to project/plugins.sbt like so:

libraryDependencies += "org.slf4j" % "slf4j-simple" % "1.7.12"
Brian Smith
  • 3,383
  • 30
  • 41