查看源代码得知zookeeper(版本3.4.13)内部的日志用的slf4j,项目启动zk连接了之后一直在打debug日志(如下所示),甚是讨厌,logback日志级别调成info没用。
17:24:53.707 [main-SendThread(DESKTOP-L0MISLK:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x1003d58f1cd0011 after 1ms 17:24:55.042 [main-SendThread(DESKTOP-L0MISLK:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x1003d58f1cd0011 after 1ms 17:24:56.376 [main-SendThread(DESKTOP-L0MISLK:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x1003d58f1cd0011 after 1ms 17:24:57.711 [main-SendThread(DESKTOP-L0MISLK:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x1003d58f1cd0011 after 1ms
原因:
在a项目里用的zk连接,而logback.xml是放在a项目的父项目b里的,在a项目自己src/main/resources里放了logback.xml(调成info级别)后,问题解决。