Last active
January 26, 2022 15:35
-
-
Save selcarpa/11f145737af41566646f7d4aed505724 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
public Client loggedFeignClient(SpringClientFactory springClientFactory) { | |
return new LoadBalancerFeignClient(new Client.Default(null, null) { | |
@Override | |
public Response execute(Request request, Request.Options options) throws IOException { | |
log.info( | |
String.format( | |
"Feign请求开始:\n###\n%s %s\n%s\n\n%s", | |
request.httpMethod().toString(), | |
request.url(), | |
request.headers().keySet().stream().map( | |
k -> | |
String.format( | |
"%s:%s", | |
k, | |
String.join(";", request.headers().get(k)))) | |
.collect(Collectors.joining("\n")), | |
request.requestBody().asString()) | |
); | |
return super.execute(request, options); | |
} | |
}, new CachingSpringLoadBalancerFactory(springClientFactory), springClientFactory); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment