SpringMVC logs request response at INFO level

   In our development and test environments, the log level is usually set to DEBUG. When deploying to a production environment, do not often set the INFO level to reduce the amount of log output. However, some request and response parameters that can be seen in DEBUG cannot be seen. In order to facilitate troubleshooting of some online problems, it is necessary to record the parameters of the request and response.
   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.
  

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326944411&siteId=291194637