Feign 启用日志

本文最后更新于:2 年前

Spring中集成openfeign, 打印日志

Feign 的日子有两层检查

1
2
3
4
5
6
7
8
9
feign.SynchronousMethodHandler {
fun executeAndDecode() {
//...
if (logLevel != Logger.Level.NONE) {
logger.logRequest(metadata.configKey(), logLevel, request);
}
//...
}
}
1
2
3
4
5
6
7
8
9
10
11
12
feign.slf4j.Slf4jLogger : feign.Logger {

//...
fun logRequest() {
if (this.logger.isDebugEnabled()) {
super.logRequest(configKey, logLevel, request);
}
}

//...
}

配置

1
2
3
4
@Bean
fun feignLoggerLevel(): Logger.Level {
return Logger.Level.FULL
}
1
2
3
logging:
level:
com.aihuishou.creative.itm.client: DEBUG