首页 » 文章 » Spring openfeign打印日志

open feign默认不打印日志,这对debug很不方便,配置方法如下

[1]配置config

@Configuration
public class UserClientConfig {

    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.HEADERS;
    }
} 

[2]配置feignclient

@FeignClient(name = "User", url = "http://localhost:8080",configuration=UserClientConfig.class)
public interface UserClient {

    @RequestMapping(method = RequestMethod.GET, value = "/user")
    List<User> getAllUsers();    

}

[2]配置application.properties

logging.level..UserClient:DEBUG

添加新评论