apache spark - How to handle multiple bindings of log4j in a Scala project? -




i working on spark project. want import library elastic4s. in sbt config file, use:

val elastic4sversion = "5.4.5" librarydependencies ++= seq(                          "com.sksamuel.elastic4s" %% "elastic4s-core" % elastic4sversion,                          // tcp client                          "com.sksamuel.elastic4s" %% "elastic4s-tcp" % elastic4sversion,                           // http client                          "com.sksamuel.elastic4s" %% "elastic4s-http" % elastic4sversion).map(_.force()) //exclusion librarydependencies ~= { _.map(_.exclude("org.slf4j", "slf4j-log4j12")) } 

when without exclusion of log4j, when excute:

val client = httpclient(elasticsearchclienturi("localhost", 9200)) 

error occurs:

slf4j: class path contains multiple slf4j bindings. slf4j: found binding in [jar:file:/home/junlang/spark-2.2.0/myspark/assembly/target/scala-2.11/jars/slf4j-log4j12-1.7.16.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/home/junlang/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.7.16.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: see http://www.slf4j.org/codes.html#multiple_bindings explanation. slf4j: actual binding of type [org.slf4j.impl.log4jloggerfactory] log4j:warn no appenders found logger (com.sksamuel.elastic4s.http.httpclient$). log4j:warn please initialize log4j system properly. log4j:warn see http://logging.apache.org/log4j/1.2/faq.html#noconfig more info.

seems spark source code includes log4j , leads multiple bindings exception.

then add exclusion code in sbt config file, , error occurs:

log4j:warn no appenders found logger (com.sksamuel.elastic4s.http.httpclient$). log4j:warn please initialize log4j system properly. log4j:warn see http://logging.apache.org/log4j/1.2/faq.html#noconfig more info.

this makes me upset.... need help!~~~~





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -