java-8 - 如何为 com.spotify.docker-client 的 http-api 禁用 log4j 调试日志
问题描述
在 Java8 中使用 log4j 1.2.17 和 com.spotify.docker-client 6.1.1。如果我在 DEBUG 中设置 log4j 根日志级别,那么 docker 客户端的 http-api 会在日志中写入许多消息,例如
09:42:50,624 DEBUG jersey-client-async-executor-0 headers:onResponseReceived:113 - http-outgoing-13 << HTTP/1.1 200 OK
09:42:50,624 DEBUG jersey-client-async-executor-0 headers:onResponseReceived:116 - http-outgoing-13 << Api-Version: 1.37
09:42:50,624 DEBUG jersey-client-async-executor-0 headers:onResponseReceived:116 - http-outgoing-13 << Docker-Experimental: false
09:42:50,624 DEBUG jersey-client-async-executor-0 headers:onResponseReceived:116 - http-outgoing-13 << Ostype: linux
09:42:50,624 DEBUG jersey-client-async-executor-0 headers:onResponseReceived:116 - http-outgoing-13 << Server: Docker/18.03.1-ce (linux)
09:42:50,624 DEBUG jersey-client-async-executor-0 headers:onResponseReceived:116 - http-outgoing-13 << Date: Thu, 04 Oct 2018 06:42:50 GMT
09:42:50,624 DEBUG jersey-client-async-executor-0 headers:onResponseReceived:116 - http-outgoing-13 << Content-Type: text/plain; charset=utf-8
09:42:50,624 DEBUG jersey-client-async-executor-0 headers:onResponseReceived:116 - http-outgoing-13 << Transfer-Encoding: chunked
我不明白如何禁用它。我所有的尝试:
log4j.rootLogger=DEBUG, stdout
log4j.logger.jersey-client-async-executor-0=INFO
log4j.logger.com.sun.jersey=INFO
log4j.logger.com.spotify=INFO
这并不能阻止它。如何禁用 jersey-client-async-executor-0 的 DEBUG-loggin ?谢谢。
解决方案
您正在将日志级别设置为Debug,然后您正在登录记录器jersey-client
,因此它也被设置为 Debug 级别。
将您的 rootlogger 设置为不同的级别,或者不要将 jersey-client 添加到记录器。
推荐阅读
- multithreading - 关于多线程 DataProvider 传递能力的问题
- python - python中的意外行为-函数从相同的输入产生不同的结果
- django - 密码在 django admin 登录页面没有加密
- python - 将python脚本转换为面向对象的程序
- javascript - 如何从 javascript 中的函数中删除 .onchange 处理程序
- c - 在c中为结构中的数组赋值
- reactjs - ReactJS modal没有使用Materialize css打开
- php - mySQL 不将 NULL 作为空字段的值
- arkit - usdz_converter 不拾取材料
- reactjs - Gutenberg 自定义块:按 innerBlocks 长度添加元素