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
You can have netty do logging of the request/responses with by asking it todo wiretaping, if you create your Spring WebClient like this then it enables the wiretap option.
WebClient webClient = WebClient.builder()
.clientConnector(new ReactorClientHttpConnector(
HttpClient.create().wiretap(true)
))
.build()
and then have your logging setup:
logging.level.reactor.netty.http.client.HttpClient: DEBUG
this will log everything for the request/response (including bodies), but the format is not specific to HTTP so not very readable.