将apache kafka的log4j桥接到akka的slf4j

vm0i2vca  于 2021-06-08  发布在  Kafka
关注(0)|答案(2)|浏览(476)

不知道为什么我不能在akka应用程序中将apachekafka0.8.1.1中的log4j消息桥接到slf4j。

log4j:WARN No appenders could be found for logger (kafka.utils.VerifiableProperties).
log4j:WARN Please initialize the log4j system properly.

sbt相关性:

"com.typesafe.akka" %% "akka-slf4j" % akkaVersion withSources() withJavadoc(),
  "org.apache.kafka" %% "kafka" % "0.8.1.1" exclude("javax.jms", "jms") exclude("com.sun.jdmk", "jmxtools") exclude("com.sun.jmx", "jmxri") withSources() withJavadoc(),
  "org.slf4j" % "log4j-over-slf4j" % "1.7.5",
  "ch.qos.logback" % "logback-classic" % "1.0.13",

我在logback中定义了根记录器,akka应用程序的日志记录良好,但是apachekafka的日志我无法通过?无双面装订等。
我忽略了什么吗?
谢谢

c2e8gylq

c2e8gylq1#

从kafka依赖中排除log4j解决了我的类似问题。

libraryDependencies += "org.apache.kafka" % "kafka_2.11" % "0.8.2.0" exclude("log4j", "log4j") exclude("org.slf4j","slf4j-log4j12")
ncgqoxb0

ncgqoxb02#

sbt相关性

"org.apache.kafka" % "kafka_2.11" % "0.8.2.0" exclude("log4j", "log4j") exclude("org.slf4j","slf4j-log4j12"),
"org.slf4j" % "log4j-over-slf4j" % "1.7.5"

相关问题