Hi,
attached you find a so called AccessLogInterceptor which I
wrote to create log files in the style of Apache httpd's
"AccessLog". It can be used like this:
<RequestInterceptor
className="org.apache.tomcat.logging.AccessLogInterceptor"
logFile="logs/AccessLog" format="combined"/>
<RequestInterceptor
className="org.apache.tomcat.logging.AccessLogInterceptor"
logFile="logs/AccessLog"
format='%h %l %u %t "%r" %>s %b "%{Referer}" "%{User-Agent}"'/>
the above elements in "server.xml" would create entries like this in
the log file
localhost - - [22/Apr/2001:13:59:47 0120] "GET /index.html HTTP/1.1" 200
292
"" "Mozilla/4.0"
Now some questions that I have:
1.) I did not find support for something similar in TomCat 3.2.1. I
may be wrong, though. Did I miss something? Or is there something
comparable in later versions?
2.) Is a RequestInterceptor the appropriate place to implement request
logs? Any other suggestions?
3.) Apache httpd access logs contain an part "first line of the request",
typically something like
GET /index.html HTTP/1.0
I did rebuild this functionality using getMethod(), getRequestURI(),
getQueryString() and getProtocol() from the HttpServletRequest
interface.
IMO it should be done in another way. Any suggestions?
4.) If the answer to 1.) is no: Would this file be accepted as a submission,
after whatever changes, of course?
Thanks,
Jochen
AccessLogInterceptor.class