Play/Scala 2.5 SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”

os8fio9y  于 2023-06-29  发布在  Scala
关注(0)|答案(2)|浏览(172)

在将Scala项目从Play Framework 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 www.example.com
我已经更新了logback.xml文件以使用play.api.libs.logback.ColoredLevel。该页面展示了如何使用其他日志框架的示例,但我希望继续使用默认的logback框架。文档没有说需要任何额外的依赖项。
我是否缺少一些依赖项?我需要做什么?

wlsrxk51

wlsrxk511#

升级过程中丢失了一个配置文件,请更新project/plugins.sbt中的Play版本号以升级Play:

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.x")

参见https://www.playframework.com/documentation/2.5.x/Migration25

k7fdbhmy

k7fdbhmy2#

我得到同样的错误,但当我使用此命令

sbt new playframework/play-scala-seed.g8

错误消息:

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.

Unexpected response status 504 fetching metadata from https://search.maven.org/solrsearch/select?q=g:%22org.scala-lang%22+AND+a:%22scala-library%22&rows=10&wt=xml&core=gav

设置信息:

$ java --version
openjdk 11.0.17 2022-10-18
OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed mode)
$ sbt --script-version
1.9.0

相关问题