環境:
SpringBoot
pom依賴了apache.commons.HttpClient:
<!--httpclient-->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
問題:
調用httpClient時會輸出一堆相關的debug日志。
解決:
官方提供了log4j、Commons Logging、java.util.logging三種日志關閉的方法,但是沒有提供SLF4J日志的關閉方法,方法如下:
在classpath下(resources目錄下)建立一個logback.xml,內容如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml" />
<logger name="*" level="warn" />
</configuration>