Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging HTTP requests and responses in quarkus resteasy

I am running into a problem with calling a REST endpoint on a server, using a REST client in Quarkus, built with the org.eclipse.microprofile.rest.client.RestClientBuilder. I would very much like to debug the service, by writing the HTTP requests and responses to the log, so I might see what is actually being sent to the server. The hunt for a guide for that particular issue has eluded me however. I managed to build a logging filter but that only logs out the URL and the Entitys toString value, which is not at all the same as the HTTP request and response being sent. Help me by pointing me to a solution to log the actual HTTP request and response.

like image 746
Martin Nielsen Avatar asked Sep 10 '25 18:09

Martin Nielsen


2 Answers

If you are using resteasy reactive you can turn on logging with:

quarkus.rest-client.logging.scope=request-response
quarkus.rest-client.logging.body-limit=1024
quarkus.log.category."org.jboss.resteasy.reactive.client.logging".level=DEBUG
like image 151
simbo1905 Avatar answered Sep 13 '25 11:09

simbo1905


You can try to enable the logging for all the traffic including wire or just some components, here in the logging configuration guide you can find how enable just some components logging.

Add this to your application.properties and you should be able to see some logging information quarkus.log.category."org.apache.http".level=DEBUG

If you need to log everything you can always put quarkus in debug level ALL, and the pick the components you need to constraint the logging, whit this you see all the traces at wire level.

You can also enable the http access log with this guide

Good luck.

like image 27
Javier Toja Avatar answered Sep 13 '25 09:09

Javier Toja