来自 Kafka Producer 的过多控制台消息 [英] Excessive console messages from Kafka Producer

查看:29
本文介绍了来自 Kafka Producer 的过多控制台消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何控制 Kafka 生产者或消费者的控制台日志记录级别?我在 Scala 中使用 Kafka 0.9 API.

How do you control the console logging level of a Kafka Producer or Consumer? I am using the Kafka 0.9 API in Scala.

每次调用 KafkaProducer 上的 send 时,控制台都会给出如下输出.这是否表明我没有正确设置 KafkaProducer,而不仅仅是日志记录过多的问题?

Every time send on the KafkaProducer is called, the console gives output like below. Could this indicate I do not have the KafkaProducer set up correctly, rather than just an issue of excessive logging?

17:52:21.236 [pool-10-thread-7] INFO  o.a.k.c.producer.ProducerConfig - ProducerConfig values: 
compression.type = none
metric.reporters = []
metadata.max.age.ms = 300000
.
.
.
17:52:21.279 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name bufferpool-wait-time
17:52:21.280 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name buffer-exhausted-records
17:52:21.369 [pool-10-thread-7] DEBUG org.apache.kafka.clients.Metadata - Updated cluster metadata version 1 to Cluster(nodes = [Node(-1, localhost, 9092)], partitions = [])
17:52:21.369 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name connections-closed:client-id-producer-2
17:52:21.369 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name connections-created:client-id-producer-2
17:52:21.370 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name bytes-sent-received:client-id-producer-2
17:52:21.370 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name bytes-sent:client-id-producer-2
.
.

Kafka 服务器和 Zookeeper 查看的 properties 文件中有日志配置,但我假设这些不会影响 Kafka 客户端.更改这些文件中的一些日志配置,并重新启动 Kafka 服务器和 Zookeeper 以重新加载这些文件,并没有解决问题.

There are logging configurations in the properties files the Kafka server and Zookeeper look at, but I've assumed these do not affect Kafka clients. Changing some of the logging configurations in these files, and restarting the Kafka server and Zookeeper so those files are reloaded, has not solved the problem.

谢谢

推荐答案

正确配置 logback 解决了我的问题:http://www.mkyong.com/logging/logback-xml-example/

Correctly configuring logback solved my problem: http://www.mkyong.com/logging/logback-xml-example/

这篇关于来自 Kafka Producer 的过多控制台消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆