Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PlayFramework 2.5: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"

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.

like image 805
matanster Avatar asked Jun 04 '16 16:06

matanster


1 Answers

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/

like image 129
Saurav Sahu Avatar answered Sep 29 '22 19:09

Saurav Sahu