Reputation: 609
I have a Java Springboot application and want to log the HTTP request body. I managed to do it by setting the field logging.level.org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor = DEBUG
in my application.properties
. This create a nice log like that when I get a request:
2020-04-27T10:12:46,041 DEBUG 40422 --- [-nio-443-exec-2] RequestResponseBodyMethodProcessor : Read "application/json;charset=UTF-8" to ["{
"cpName":"SSA, Test 1",
"contractId":"1234567",
"contractName":"SSA, Contract 1",
"scnName":" (truncated)...]
However, only the beginning of the body is shown. I don't have the value for the field scnName
and there is another field after this one called description
that does not appears either. I search but could not find a way to write the whole body in the log. Is there any settings to change to print everything?
Thank you in advance.
Upvotes: 2
Views: 12927
Reputation: 2890
Set the logging level to TRACE:
logging.level.org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor=TRACE
Source: SPR-17254 (#21787)
The logging of encoded and decoded values, for both Spring MVC and WebFlux, now logs the full value at TRACE, and up to 100 chars at DEBUG. ...
Upvotes: 15