PlayFramework 2.5:SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”

时间:2016-06-04 16:20:22

标签: scala playframework sbt

我在sbt中添加了一个库依赖

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

为了解决:

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.

它确实出现在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)

然而问题仍然存在。 可能是什么?

另外,在相关流程的ps输出中,slf4j-simple 未显示

播放2.5 introduced logging changes,我使用play作为库而不是框架插件,所以我必须模仿所需的配置 - 顶部显示的NOP日志记录默认需要更换以确保正确日志记录。我怎样才能了解正在发生的事情?

我看过几个类似的问题,但他们并没有直接推断这个问题。

1 个答案:

答案 0 :(得分:0)

将此依赖项添加到 build.sbt。它对我有用:

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

关于 logback 的更多信息:http://logback.qos.ch/