Reputation: 39
I have build.sbt file:
name := """test"""
version := "1.0-SNAPSHOT"
scalaVersion := "2.12.6"
val loggingDependencies = Seq(
"com.typesafe.scala-logging" %% "scala-logging" % "3.+",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"ch.qos.logback" % "logback-core" % "1.+"
)
libraryDependencies ++= Seq(
...
"org.slf4j" % "slf4j-api" % "1.8.0-beta1",
"org.slf4j" % "slf4j-simple" % "1.8.0-beta1",
)
After I add this dependence
lazy val root = (project in file(".")).enablePlugins(PlayScala)
I got an error
java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
All advices didn't help at all! What's wrong with it!
Upvotes: 1
Views: 1342
Reputation: 170745
These versions aren't compatible, see https://www.slf4j.org/faq.html#changesInVersion18 and https://logback.qos.ch/news.html. If you want Logback 1.2.3, you need SLF4J 1.7.x, if you want unstable SLF4J 1.8, you need (also unstable) Logback 1.3.x.
"ch.qos.logback" % "logback-classic" % "1.2.3",
"ch.qos.logback" % "logback-core" % "1.+"
Having different versions for logback-classic
and logback-core
also doesn't make sense to me.
The final problem is having both slf4j-simple
and logback
in dependencies.
EDIT: Play uses Logback on its own if not disabled explicitly, so it already will have some Logback and SLF4J versions in dependencies, and you override that SLF4J with an incompatible version (and add slf4j-simple
which can't be used together with Logback). Either remove your dependencies or follow the linked documentation if you want to override what Play does.
Upvotes: 1