1

I want to build a simple Spring Web Client who send message from stdin but the WebClient show all debug informations on stdout.

How to disable the logs generated by Webclient ?

Code of the client

WebClient webclient = WebClient.builder().baseUrl("http://localhost:8080/").build();
webClient.post().uri(uriBuilder -> uriBuilder.path("/test").queryParam("id",1).build()).retrieve().bodyToMono(Log.class).block();
Ryoh
  • 27
  • 6

1 Answers1

0

you can customize your logs as you want. as the image you mention,
Go to the application.properties put logger values to disable as OFF [io.netty]

logging.level.io.netty=off

do you want to fully disable all logs from your project, disable root below.

logging.level.root=off
Mafei
  • 1,785
  • 1
  • 10
  • 25
  • Unfortunately, it doesn't work for me. Maybe it's because I'm directly using a webclient in a main without using springbootaplication? I will edit my post to show the client code. – Ryoh Dec 28 '20 at 18:32
  • Please try out with this ```logging.level.reactor.netty.http.client=OFF``` – Mafei Dec 28 '20 at 18:38
  • and refer this https://stackoverflow.com/questions/46154994/how-to-log-spring-5-webclient-call – Mafei Dec 28 '20 at 18:40
  • Ok, it work but only if i use @SpringBootApplication and SpringApplication.run(testClient.class, args); Do you think there is an alternative without that? Thanks for your help – Ryoh Dec 28 '20 at 18:45
  • I'm not familiar much with spring web client bro. anyway please refer this too https://stackoverflow.com/questions/46154994/how-to-log-spring-5-webclient-call – Mafei Dec 28 '20 at 18:50