Spring openfeign打印日志

发布于 / 随记 / 0条评论 / Tags: java,springcloud / 6 次浏览

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

    评论区(暂无评论)