1.配置訪問級別DEBUG
// yml文件中配置日誌級別
logging:
level:
com.example.demo.FeignTestService: DEBUG
2.定義配置文件,無配置文件日誌不生效
@Configuration
public class FooConfiguration {
@Bean
Logger.Level feignLoggerLevel() {
return Logger.Level.FULL;
}
}
可以看到日誌已經打印出來
3.優先級問題
如果yml文件和@Configuration都配置了,哪個生效的問題,答案是yml文件中內容生效,參閱官方文檔:
If we create both @Configuration bean and configuration properties, configuration properties will win. It will override @Configuration values. But if you want to change the priority to @Configuration, you can change feign.client.default-to-properties to false.
如果想讓@Configuration 中內容先生效,可以配置feign.client.default-to-properties=false