http - 如何在 Spring MVC 中记录 Http 请求主体?

标签 http logging spring-mvc request

只是认为这将是开发阶段的一个有用功能。它是我可以配置的还是需要一些编码?谢谢堆垛机!

最佳答案

使用:spring-mvc-logger

添加到 pom.xml:

<dependency>
    <groupId>com.github.isrsal</groupId>
    <artifactId>spring-mvc-logger</artifactId>
    <version>0.2</version>
</dependency>

添加到 web.xml 中:

<filter>
    <filter-name>loggingFilter</filter-name>
    <filter-class>com.github.isrsal.logging.LoggingFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>loggingFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

添加到 log4j.xml:

<logger name="com.github.isrsal.logging.LoggingFilter">
    <level value="DEBUG"/>
</logger>

关于http - 如何在 Spring MVC 中记录 Http 请求主体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4726824/

相关文章:

java - 如何获取包含javascript内容的html内容?

java - 将 Android 平板电脑与蓝牙设备配对后使用 logcat

logging - MongoDB 存储不同的(模式)日志文件

java - 如何修复 Apache Tomcat 6 服务器中的 java spring mvc web 应用程序运行时间?

javascript - 关注ajax调用后div中显示的成功消息

java - 如何配置 Spring REST 服务来处理多个版本?

asp.net-mvc - Nginx到iis转发报错400

php - 用 php 返回特定的 http 状态码

java - 如何在 C++ 中读取 java 对象?

http - 我可以在重定向请求时检查响应吗?