There are many ways to achieve this requirement, such as adding Filter, manually recording logs, etc. Here is a simple way to directly output the request and response content at the DEUBG level. The system uses logback to record logs. You can directly adjust the log level of the request and response processing classes to DEBUG in logbak.xml.
<logger name="org.apache.coyote.http11.Http11InputBuffer" level="DEBUG" /> <logger name="org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor" level="DEBUG" />
If you don't use logback, it should be possible to use similar ideas.