1.在application.properties开启日志记录:
logging.level.cn.edu.tju.service.TestClient=DEBUG
其中loggijng.level是固定的,=DEBUG也是固定的,其余部分是Feign client的全限定类名
2.创建日志bean:
package cn.edu.tju.config;
import feign.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class LogConfig {
@Bean
Logger.Level feignLoggerLevel() {
return Logger.Level.FULL;
}
}
这个bean是记录所有日志。也可以用Logger.Level枚举里的其他值(NONE或BASIC或HEADERS)