gpt4 book ai didi

java - Spring MVC : easiest way to see incoming requests

转载 作者:行者123 更新时间:2023-11-28 22:07:17 25 4
gpt4 key购买 nike

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

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

GET /index.htmlGET /img/logo.pngGET /js/a.jsGET /style/b.cssPOST /ajax/dothis?blah=yesPOST /ajax/dothat?foo=npGET /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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com