Spring MVC: easiest way to see incoming requests
I am debugging a Spring MVC (3.0) app, deployed on tomcat.
I want to see in my console or log files all the incoming requests. Including 404s, both generated by my app or by spring because it didn't find an appropriate controller. I'd like to see something like this:
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 ...
What is the easiest way to see that.
You can turn on logging incoming connection in tomcat in server.xml file:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
It turns on logging in Apache webserver style.
More information about this you can find here: http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html
You can try JavaMelody:
The goal of JavaMelody is to monitor Java or Java EE applications servers in QA and production environments. It is not a tool to simulate requests from users, it is a tool to measure and calculate statistics on real operation of an application depending on the usage of the application by users.
http://code.google.com/p/javamelody/
you can use client side tools i.e. firebug in order to see the request and response.
精彩评论