java - Spring MVC : easiest way to see incoming requests

标签 java spring tomcat logging spring-mvc

我正在调试部署在 tomcat 上的 Spring MVC (3.0) 应用程序。

我想在我的控制台或日志文件中查看所有传入请求。包括 404,都是由我的应用程序或 spring 生成的,因为它没有找到合适的 Controller 。我希望看到这样的内容:

GET /index.html
GET /img/logo.png
GET /js/a.js
GET /style/b.css
POST /ajax/dothis?blah=yes
POST /ajax/dothat?foo=np
GET /nextpage.html
...

什么是最简单的查看方式。

最佳答案

您可以在 server.xml 文件中打开记录传入连接的 tomcat:

       <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
           prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>

它以 Apache 网络服务器样式打开日志记录。

有关此的更多信息,您可以在此处找到: http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html

关于java - Spring MVC : easiest way to see incoming requests,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2763956/

相关文章:

java - 放入 Java 应用程序时如何更改光标

java - 为 DriverManager.getConnection 获取 java.lang.NumberFormatException

spring - 提取数组的值并添加到同一个选择的mongoDB中

java - 枚举,静态方法和实现接口(interface)方法有什么用?

java - Partitioner 类型的 getPartition 的名称冲突在 MapReduce、Hadoop 中具有相同类型主类的删除

java - 防止 Spring Boot 将日志打印到控制台

java - 删除时不支持请求方式GET

java - 使用 Postgresql 的 Spring Boot 的 Tomcat 配置

Apache /Tomcat/Railo : Setting up two sites with same domain but two different ports

tomcat - 在 Tomcat 上运行 Grails 应用程序时遇到问题