解决httpclient在控制台输出DEBUG日志

httpclient在运行或者调试中会在控制台一直打印日志如下代码:

21:57:41.413 [main] DEBUG org.apache.http.wire - << "                                   [\r][\n]"
21:57:41.413 [main] DEBUG org.apache.http.wire - << "[\r][\n]"
21:57:41.413 [main] DEBUG org.apache.http.wire - << "                                   [\r][\n]"
21:57:41.413 [main] DEBUG org.apache.http.wire - << "                               [\n]"
21:57:41.413 [main] DEBUG org.apache.http.wire - << "    [\n]"
21:57:41.424 [main] DEBUG org.apache.http.wire - << "[\n]"
21:57:41.425 [main] DEBUG org.apache.http.wire - << "[\r][\n]"
21:57:41.425 [main] DEBUG org.apache.http.wire - << "[\r][\n]"
21:57:41.425 [main] DEBUG org.apache.http.wire - << "                   
[\r][\n]" 21:57:41.425 [main] DEBUG org.apache.http.wire - << " [\r][\n]" 21:57:41.425 [main] DEBUG org.apache.http.wire - << " [\r][\n]" 21:57:41.425 [main] DEBUG org.apache.http.wire - << " [\r][\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - << " [\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - << "
[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - << "
[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - << "
[\n]" 21:57:41.442 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - << "
[\n] " 21:57:41.443 [main] DEBUG org.apache.http.wire - << "
[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - << "
[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - << "
[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - << "
[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - << "[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - << "
[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - << "
[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - << "[\n]"

而SpringBoot使用logback框架,需要自己创建logback.xml,并放置于src目录下,添加内容如下:


  
  
    
      %-4relative [%thread] %-5level %logger{35} - %msg %n
    
  

  
    
    
   

重新运行java工程,控制台不在打印DEBUG日志。

你可能感兴趣的:(解决httpclient在控制台输出DEBUG日志)