Logging Request And Response Body In Spring Boot
Vložit
- čas přidán 2. 04. 2022
- Hi Friends,
#GainJavaKnowledge
In this video, we are going to learn how to log request and response body using Filter class in spring boot project. oncePerRequestFilter.
GitHub Link To Download The Source Code :
===================================
github.com/sumitMultani/Sprin... - Věda a technologie
Great, it worked at my side. thank you so much
Very good.. Spring Boot Videos. Loving all of it and learning a lot
Thanks Rajiv 😊
THanks for the help sir!
Thanks Maks Silva
Thanks
for me it worked well for simple json response but for complex json response it prints some different encoding.
Thanks bro
Welcome
i ama learner. can we use the same for webflux rest api also ? if not is there similar methodology exist for webflux rest api.
What if we get the value from the header?
We can print value in logs like uuid to trace the request
Why can't we use request.getBody() and response.getBody() methods as we used response.getStatus() to know the status of the API response?
There is no such method request.getBody() for HttpServletRequest and response.getBody() for HttpServletresponse(I).
nice, but i don't actually get the real time to execute the API since in my case this is the 4th filter invoked in the chain
If there is any requirement to print a request and response body in your logs after code deployed on the production environment it will be helpful to track the request if we are getting any failure or unexpected result.