Kafka Consumer将过多的DEBUG语句输出到控制台(ecilpse) [英] Kafka Consumer outputs excessive DEBUG statements to console (ecilpse)
问题描述
我正在运行一些来自 http://www.javaworld.com/article/3060078/big-data/big-data-messaging-with-kafka-part-1.html?page=2 ,并且kafkaconsumer根据需要从主题中消耗,但是每个轮询都导致许多调试日志的打印(到标准输出),这是我不想要的。
I'm running some sample code from http://www.javaworld.com/article/3060078/big-data/big-data-messaging-with-kafka-part-1.html?page=2, and the kafkaconsumer is consuming from topic as desired, but every poll results in print (to std out) of many debug logs, which I don't want.
我已尝试在 /config/log4j.properties
中将所有INFO和DEBUG更改为ERROR(甚至确实需要grep),特别是设置 log4j.logger.kafka = ERROR
,kafkaAppender,但问题仍然存在。我提到如何为Kafka生产者配置日志记录?,并采用那里的解决方案,但消费者的情况可能不同?
I have tried changing all INFO and DEBUG to ERROR (even did a grep to make sure) in /config/log4j.properties
, in particular setting log4j.logger.kafka=ERROR
, kafkaAppender, but the problem persists. I referred to How to configure logging for Kafka producers?, and adopted the solution there, but perhaps the situation is different for consumers?
DEBUG消息都有类似的格式:
The DEBUG messages all have a similar format:
[Thread-0] DEBUG org.apache.kafka.clients.consumer.internals.Fetcher - Sending fetch for partitions... to broker... (id: 0 rack: null)
并且每秒钟以10的速率出现(将poll参数更改为1000甚至10000)没有帮助,我试过了)
and are appearing at rate of 10 every second or so (changing poll argument to 1000 or even 10000 doesn't help, I tried)
非常感谢任何专家的帮助。提前致谢!
Would really appreciate any help from any expert. Thanks in advance!
编辑:不确定是否重要,但我添加了 BasicConfigurator.configure();
to我的主要方法,解决之前发生的一些其他错误,阻止消费者甚至开始。
Not sure if it matters, but I added BasicConfigurator.configure();
to my main method, to resolve some other error occurring previously that stopped the Consumer from even starting.
推荐答案
只需修改日志记录级别讨厌的课(聊天互动)。
因为在您的日志中,您会看到来自 org.apache.kafka.clients.consumer.internals.Fetcher
的日志条目,您只需调整该记录器的日志记录级别通过将以下行添加到 log4j.properties
:
Just modify the logging level of the chatty class (chatty interaction).
Since in your logs you see log entries originating from org.apache.kafka.clients.consumer.internals.Fetcher
you can simply adjust the logging level for that logger by adding following line to log4j.properties
:
log4j.logger.org.apache.kafka.clients.consumer.internals.Fetcher=WARN
...或更宽捕获记录器,因为这些是名称间隔:
... or any wider catching logger since these are name spaced:
# adjusting logging for entire Kafka
log4j.logger.org.apache.kafka=WARN
希望这会有所帮助
这篇关于Kafka Consumer将过多的DEBUG语句输出到控制台(ecilpse)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!