Scala sbt console to enable login

I am trying to use logback with slf4j in my scala application. I have included the following in build.sbt

libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.5" 
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.1.3"
libraryDependencies += "ch.qos.logback" % "logback-core" % "1.1.3"

      

I tried to call sbt console -Dlogback.configurationFile=logback.xml -DLOG_DIR=.

But I can see multiple bindings (log4j and logback) in the sbt classpath.

  SLF4J: Found binding in [jar:file:~/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: Found binding in [jar:file:~/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

      

I'm not sure how the log4j drum is being pulled to .ivy2.

build.sbt

 libraryDependencies += "org.apache.spark" %% "spark-streaming" % "1.2.1"
 libraryDependencies += "org.apache.spark" %% "spark-core" % "1.2.1"
 libraryDependencies += "com.datastax.spark" %% "spark-cassandra-connector" % "1.2.1"
 libraryDependencies += "com.datastax.spark" %% "spark-cassandra-connector-java" % "1.2.1"
 libraryDependencies += "com.google.protobuf" % "protobuf-java" % "2.5.0"
 libraryDependencies += "spark.jobserver" % "job-server-api" % "0.5.0" % "provided"
 libraryDependencies += "net.liftweb" %% "lift-json" % "2.5.3"
 libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.4" % "test"
 libraryDependencies += "com.github.nscala-time" %% "nscala-time" % "2.0.0"
 libraryDependencies += "net.sf.opencsv" % "opencsv" % "2.3"
 libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.5"
 libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.1.3"
 libraryDependencies += "ch.qos.logback" % "logback-core" % "1.1.3"

      

Questions:

1) Are the dependency bans in my build.sbt file downloadable by log4j?

2) How can I make sure slf4j only communicates with logback in sbt console?

+3


source to share





All Articles