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