我正在尝试为来自 Feign 休息客户端的每个请求进行日志记录。但是我无法让日志记录工作,而“标准”Slf4j 日志记录确实有效。
我有以下内容:
public MyClient() {
initConnectionProperties();
this.service = Feign.builder()
.contract(new JAXRSContract())
.decoder(getJacksonDecoder())
.encoder(getJacksonEncoder())
.requestInterceptor(new BasicAuthRequestInterceptor(user, password))
//.client(new OkHttpClient())
.logger(new Slf4jLogger(MyClient.class)) //not working
.logLevel(feign.Logger.Level.BASIC)
.target(MyClient.class, this.url);
logger.info("Connection parameters: url = " + url + ", user = " + user); //Is working
}