If we want to log all the requests [time, what was accessed, the Response status e.t.c], we need to add a valve to the context.xml file like
<Valve
className="org.apache.catalina.valves.FastCommonAccessLogValve"
directory="${catalina.home}/logs/"
prefix="access_log"
fileDateFormat="yyyy-MM-dd.HH"
suffix=".log"
pattern="%t %H cookie:%{SESSIONID}c request:%{SESSIONID}r %m %U %s %q %r"/>
This allows the tomcat to create a log file under the logs directory in tomcat home and create a file with the prefix access_log and add the requests that came .
A excerpt from the access_log in my box ,
[24/Jun/2010:01:22:33 -0500] HTTP/1.1 cookie:- request:- GET /manager/html 200 GET /manager/html HTTP/1.1
[24/Jun/2010:01:22:36 -0500] HTTP/1.1 cookie:- request:- GET /SimpleSample/ 200 GET /SimpleSample/ HTTP/1.1
[24/Jun/2010:01:22:36 -0500] HTTP/1.1 cookie:- request:- POST /SimpleSample/SimpleSampleServlet 200 POST /SimpleSample/SimpleSampleServlet HTTP/1.1
More Articles To Come , So Happy Coding....
No comments :
Post a Comment