I\'m trying to log a request using Spring 5 WebClient. Do you have any idea how could I achieve that?
(I\'m using Spring 5 and Spring boot 2)
The code looks
If you don't want to log the body, then this is really easy.
Add the following to application.properties:
logging.level.org.springframework.web.reactive.function.client.ExchangeFunctions=TRACE
spring.http.log-request-details=true
The second line causes headers to be included in the log.
Add the following to application.properties:
logging.level.org.springframework.web.reactive.function.client.ExchangeFunctions=TRACE
Instead of the second line above, you need to declare a class like this:
@Configuration
static class LoggingCodecConfig {
@Bean
@Order(0)
public CodecCustomizer loggingCodecCustomizer() {
return (configurer) -> configurer.defaultCodecs()
.enableLoggingRequestDetails(true);
}
}
Courtesy of this Brian Clozel answer