不要打印kafka-console-consumer警告 [英] Don't print the kafka-console-consumer warnings

查看:381
本文介绍了不要打印kafka-console-consumer警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将加密的消息调试到Kafka集群上.显然,这些消息充满了不可打印的字符,并且无法在控制台上使用,因此我想将输出保存在这样的文件中:

I am trying to debug encrypted messages onto a Kafka cluster. Obviously these messages are full of non printable characters and are not usable on a console, so I wanted to save the output in a file like this:

kafka-console-consumer \
    --zookeeper 0.zookeeper.local,1.zookeeper.local \
    --max-messages 1 \
    --topic MYTOPIC > /tmp/message

我无法解密结果消息,因为输出包含密文和警告消息,例如:

I am unable to decrypt the resulting message, because the output contains, along with the ciphertext, warning messages such as:

[2016-02-24 11:52:47,488] WARN Reconnect due to socket error: null (kafka.consumer.SimpleConsumer)

是否可以在文件中获取一条消息,并将警告嵌入该文件中?

Is there a way to get one single message in a file and NOT embed the warnings in that file?

推荐答案

对于入站控制台工具,有一个特殊的记录器配置文件.请在 [kafka_home]/config/tools-log4j.properties 文件中将记录器级别从WARN更改为OFF.该文件应如下所示:

There is a special logger config file for inbound console tools. Please, change the logger level from WARN to OFF in [kafka_home]/config/tools-log4j.properties file. The file should look like:

tools-log4j.properties

log4j.rootLogger=OFF, stdout 

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n

之后,您只会在控制台中收到消息.

After it you will get only messages in console.

这篇关于不要打印kafka-console-consumer警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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