【SpringBoot】关闭HttpClient无用日志

环境:

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>
posted @ 2017-08-21 16:07  puyangsky  阅读(3799)  评论(0编辑  收藏  举报