How to configure logbook logging in feign via ApacheHttpClient?

1.4k Views Asked by At

I have a rest project on spring-boot (v. 2.2.2.RELEASE) using spring cloud openfeign (v. Hoxton.SR7) and logging requests and responses via org.zalando.logbook (v. 2.3.0). Logbook succesfully log requests and responses via RestController into my application, but doesn't log requests and responses from my app to another services. So, for logging I want to add logbook interceptors (org.zalando.logbook.httpclient.LogbookHttpRequestInterceptor and org.zalando.logbook.httpclient.LogbookHttpResponseInterceptor) into HttpClient in feign config org.springframework.cloud.openfeign.clientconfig.HttpClientFeignConfiguration for logging, but I can't do it because of method org.springframework.cloud.openfeign.clientconfig.HttpClientFeignConfiguration#createClient is private and no one method for customization HttpClient.

Is there any way to customize Feign httpClient or another way to add logging via logbook?

0

There are 0 best solutions below