我正在调试部署在 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/