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

问题描述

我正在使用Jetty 8和ZooKeeper 3.4.5.当我连接到ZooKeeper时,码头会继续生成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会生成调试日志消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 16:47