java 修改第三方库,如何在Java中更改第三方库的日志级别

The console logs is cluttered with logs from 3rd part libraries. For example my project uses kafka and zooker keeper client libraries because of this there are too many logs from them

2018-05-08 10:30:38.250 INFO 2968 --- [0:0:0:0:1:2181)]

org.apache.zookeeper.ClientCnxn : Opening socket connection

to server 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:2181. Will not attempt to

authenticate using SASL (unknown error)

2018-05-08 10:30:38.309 INFO 2968 --- [ main]

o.a.k.clients.producer.ProducerConfig : ProducerConfig values:

there is a log4j2.xml file in my project. Changing root log level in xml file only changes log level of the custom logs generated by my project.

Is there a way to stop or changes logs of these libraries

解决方案

Switch to Logback and change the logging level for flooding logger. Usually, it names after its class reference.

%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值