Play/Scala 2.5 SLF4J:无法加载 class "org.slf4j.impl.StaticLoggerBinder"
Play/Scala 2.5 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
将 Scala 项目从 Play Framwork 2.4 升级到 2.5 后出现以下错误:
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.
java.lang.NoSuchMethodError: play.api.Logger$.init(Ljava/io/File;Lscala/Enumeration$Value;)V
根据这些页面:
https://www.playframework.com/documentation/2.5.x/Migration25#change-to-logback-configuration
https://www.playframework.com/documentation/2.5.x/SettingsLogger
我已将 logback.xml
文件更新为使用 play.api.libs.logback.ColoredLevel
。该页面显示了如何使用其他日志记录框架的示例,但我希望继续使用默认的 logback 框架。文档没有说需要任何额外的依赖项。
我是否遗漏了一些依赖项?我需要做什么?
升级过程中遗漏了一个配置文件,更新project/plugins.sbt中的Play版本号来升级Play:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.x")
见https://www.playframework.com/documentation/2.5.x/Migration25
将 Scala 项目从 Play Framwork 2.4 升级到 2.5 后出现以下错误:
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.
java.lang.NoSuchMethodError: play.api.Logger$.init(Ljava/io/File;Lscala/Enumeration$Value;)V
根据这些页面:
https://www.playframework.com/documentation/2.5.x/Migration25#change-to-logback-configuration https://www.playframework.com/documentation/2.5.x/SettingsLogger
我已将 logback.xml
文件更新为使用 play.api.libs.logback.ColoredLevel
。该页面显示了如何使用其他日志记录框架的示例,但我希望继续使用默认的 logback 框架。文档没有说需要任何额外的依赖项。
我是否遗漏了一些依赖项?我需要做什么?
升级过程中遗漏了一个配置文件,更新project/plugins.sbt中的Play版本号来升级Play:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.x")
见https://www.playframework.com/documentation/2.5.x/Migration25