当调用HttpClient的API发送GET或POST请求时,总会在控制台中打印DEBUG信息,诸如:
......
13:28:46.648 [main] DEBUG org.apache.http.headers - http-outgoing-2 >> Content-Type: application/json;charset=UTF-8
13:28:46.648 [main] DEBUG org.apache.http.headers - http-outgoing-2 >> Content-Length: 251
13:28:46.648 [main] DEBUG org.apache.http.headers - http-outgoing-2 >> Host: 10.10.10.11:3000
13:28:46.648 [main] DEBUG org.apache.http.headers - http-outgoing-2 >> Connection: Keep-Alive
13:28:46.648 [main] DEBUG org.apache.http.headers - http-outgoing-2 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_361)
13:28:46.648 [main] DEBUG org.apache.http.headers - http-outgoing-2 >> Accept-Encoding: gzip,deflate......
通过调试以及根据网上的经验,如果是一个Java的main类中调试,则可直接在类中进行日志配置:
static {
// 屏蔽请求过程所有的debug日
最低0.47元/天 解锁文章

6593

被折叠的 条评论
为什么被折叠?



