Kafka示例,log4j WARN和MANIFEST.MF

时间:2016-07-17 10:50:16

标签: scala apache-kafka

我是kafka的新手,我尝试做这个例子https://github.com/smallnest/kafka-example-in-scala 我有Windows 10,所以我也尝试在这个网站上找到一些信息http://blog.anilot.tk/2014/08/06/Set-Up-Kafka-On-Windows/

当我尝试运行此生产者时,我的问题就出现了。

java -cp kafka_example-0.1.0-SNAPSHOT.jar com.colobu.kafka.ScalaProducerExample 10000 test_topic localhost:9092

开始时我遇到了log4j的问题:

log4j:WARN no appenders could be found for logger kafka.utils.VerifiableProperties
log4j:Warn Please initialize the log4j system properly
sent per second: 129870

我在某处读到了我可以在命令行中添加它:

-Dlog4j.configuration=file:///path/to/your/log4j.properties

这是工作,但我得到这样的东西:

[2016-07-17 12:39:17,567] INFO Verifying properties (kafka.utils.VerifiableProperties)
[2016-07-17 12:39:17,583] INFO Property metadata.broker.list is overridden to localhost:9092 (kafka.utils.VerifiableProperties)
[2016-07-17 12:39:17,583] INFO Property producer.type is overridden to async (kafka.utils.VerifiableProperties)
[2016-07-17 12:39:17,598] INFO Property serializer.class is overridden to kafka.serializer.StringEncoder (kafka.utils.VerifiableProperties)
[2016-07-17 12:39:17,645] WARN Can't read Kafka version from MANIFEST.MF. Possible cause: java.lang.NullPointerException (kafka.common.AppInfo$)
[2016-07-17 12:39:17,714] INFO Shutting down producer (kafka.producer.Producer)
[2016-07-17 12:39:17,730] INFO Begin shutting down ProducerSendThread (kafka.producer.async.ProducerSendThread)
[2016-07-17 12:39:17,730] INFO Fetching metadata from broker id:0,host:localhost,port:9092 with correlation id 0 for 1 topic(s) Set(test_topic) (kafka.client.ClientUtils$)
[2016-07-17 12:39:17,783] INFO Connected to localhost:9092 for producing (kafka.producer.SyncProducer)
[2016-07-17 12:39:17,799] INFO Disconnecting from localhost:9092 (kafka.producer.SyncProducer)
[2016-07-17 12:39:17,830] INFO Connected to MYNAMEPC:9092 for producing (kafka.producer.SyncProducer)
[2016-07-17 12:39:17,984] INFO Shutdown ProducerSendThread complete (kafka.producer.async.ProducerSendThread)
[2016-07-17 12:39:17,999] INFO Closing all sync producers (kafka.producer.ProducerPool)
[2016-07-17 12:39:17,999] INFO Disconnecting from MYNAMEPC:9092 (kafka.producer.SyncProducer)
[2016-07-17 12:39:17,999] INFO Producer shutdown completed in 285 ms (kafka.producer.Producer)

我试图找到解决方案,但我的努力没有成功。 我将不胜感激。

0 个答案:

没有答案