gpt4 book ai didi

java - 在 Java Zookeeper api 中禁用日志消息

转载 作者:行者123 更新时间:2023-11-30 07:58:33 25 4
gpt4 key购买 nike

我反复收到这些日志消息..

12:31:39.085 [localhost-startStop-1-SendThread(localhost:2182)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x14f7213a94000bc after 0ms

12:31:39.142 [localhost-startStop-1-SendThread(localhost:2182)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x14f7213a94000be after 0ms

12:31:39.142 [localhost-startStop-1-SendThread(localhost:2182)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x14f7213a94000bd after 0ms

12:31:39.183 [localhost-startStop-1-SendThread(localhost:2182)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x14f7213a94000bf after 0ms

12:31:39.183 [localhost-startStop-1-SendThread(localhost:2182)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x14f7213a94000c0 after 0ms

12:31:39.256 [localhost-startStop-1-SendThread(localhost:2182)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x14f7213a94000c1 after 0ms

我也将 log4j2.xml 更改为 root level =“OFF”。

如何关闭此日志记录?

最佳答案

您可以在 log4j2.xml 中添加另一个记录器来更改 Zookeeper 的日志级别。假设您已经定义了名为 file 的 Appender,您可以添加 Logger 部分,如下所示

<Appenders>
<RollingFile name="file" ...
...
</RollingFile>
</Appenders>
<Loggers>
...
<Logger name="org.apache.zookeeper" level="warn" additivity="false">
<AppenderRef ref="file"/>
</Logger>
...
</Loggers>

关于java - 在 Java Zookeeper api 中禁用日志消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32279748/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com