使用Spring Cloud Feign 日志查看请求响应
在使用微服务时,常常会用feign做客户端去调用别的微服务,但是在日志中很难查看到具体的请求和响应。因此,需要把feign默认的日志打开。
日志设置
- 创建feign配置类
@Configuration
public class FeignLogConfiguration {
@Bean
Logger.Level feignLoggerLevel() {
return Logger.Level.FULL;
}
}
- 其中
Logger.Level是枚举类

- 在
application.properties或者application.yml文件中设置Feign客户端的日志级别----->可以看到feign客户端的请求响应
logging.level.com.wugui.spring.cloud.weather.Service:debug
- 其中com.wugui.spring.cloud.weather.Service为feign client接口所在包

日志查看


浙公网安备 33010602011771号