在 Jetty 中嵌入 Apache ZooKeeper 生成调试日志消息 [英] Embed Apache ZooKeeper in Jetty generates Debug log message

查看:51
本文介绍了在 Jetty 中嵌入 Apache ZooKeeper 生成调试日志消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Jetty 8 和 ZooKeeper 3.4.5.当我连接到 ZooKeeper 时,jetty 不断生成 DEBUG 级别的消息.怎么压制?

I am using Jetty 8 and ZooKeeper 3.4.5. When I connect to ZooKeeper, jetty keep generating DEBUG level message. How to suppress it?

16:54:56.757 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:56.758 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:56.758 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:56.759 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:56.760 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:56.760 [main-SendThread(127.0.0.1:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x13ddc6e9a2b000c after 3ms
16:54:56.760 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:58.424 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:58.425 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:58.425 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:58.426 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:58.427 [main-SendThread(127.0.0.1:2181)] DEBUG o.a.z.client.ZooKeeperSaslClient - Could not retrieve login configuration: java.lang.SecurityException: Unable to locate a login configuration
16:54:58.427 [main-SendThread(127.0.0.1:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x13ddc6e9a2b000c after 2ms

我在src文件夹下添加了log4j.properties:

I added log4j.properties under src folder:

# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r - [%t] %-5p %c %x - %m%n

log4j.logger.org.apache.zookeeper.ZooKeeper=INFO

仍然没有运气.

推荐答案

我再次检查了包含的库,发现包含了 LogBack.我认为 JVM 加载 logback 而不是 log4j.一旦我提供了 logback.xml,问题就解决了.

I have checked again my included library, and I found out that LogBack was included. I think JVM load logback instead of log4j. Once I supply logback.xml, the problem is solved.

这篇关于在 Jetty 中嵌入 Apache ZooKeeper 生成调试日志消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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