logo       

CustomRequestLog.java: msg#00033

java.jetty.general

Subject: CustomRequestLog.java

Hi guys,
I'm finalizing the implementation of CustomRequestLog.java, basically
an implementation of the functionality contained in Apache's mod_log_config.
The parser for the log-format string is finished and the main loop to create
the log entry too. The problem I am now facing (due to my inexperience with
Jetty) is that I don't know how to get at the following information from
HttpRequest and/or HttpResponse (excerpt from
http://httpd.apache.org/docs/mod/mog_log_config.html):

%...a: Remote IP-address
%...A: Local IP-address
%...B: Bytes sent, excluding HTTP headers.
%...b: Bytes sent, excluding HTTP headers. In CLF format
i.e. a '-' rather than a 0 when no bytes are sent.
%...c: Connection status when response was completed.
'X' = connection aborted before the response completed.
'+' = connection may be kept alive after the response is sent.
'-' = connection will be closed after the response is sent.
%...{FOOBAR}e: The contents of the environment variable FOOBAR
%...f: Filename
%...h: Remote host
%...H The request protocol
%...{Foobar}i: The contents of Foobar: header line(s) in the request
sent to the server.
%...l: Remote logname (from identd, if supplied)
%...m The request method
%...{Foobar}n: The contents of note "Foobar" from another module.
%...{Foobar}o: The contents of Foobar: header line(s) in the reply.
%...p: The canonical Port of the server serving the request
%...P: The process ID of the child that serviced the request.
%...q The query string (prepended with a ? if a query string exists,
otherwise an empty string)
%...r: First line of request
%...s: Status. For requests that got internally redirected, this is
the status of the *original* request --- %...>s for the last.
%...t: Time, in common log format time format (standard english format
)
%...{format}t: The time, in the form given by format, which should
be in strftime(3) format. (potentially localized)
%...T: The time taken to serve the request, in seconds.
%...u: Remote user (from auth; may be bogus if return status (%s) is 4
01)
%...U: The URL path requested, not including any query string.
%...v: The canonical ServerName of the server serving the request.
%...V: The server name according to the UseCanonicalName setting.


Done sofar:
%...a: use request.getRemoteAddr()
%...A: use InetAddress.getByName(request.getHost()) (inefficient??)
%...B: use responseLength
%...b: use responseLength
%...c: don't know (maybe response.getState() in conjunction with
response.getField(HttpFields.__KeepAlive) ??)
%...{Foobar}e: use System.getProperty("Foobar") or ignore
%...f: don't know
%...h: use request.getRemoteHost()
%...H: use request.getScheme()
%...{Foobar}i: use request.getField("Foobar")
%...l: don't know
%...m: use request.getMethod()
%...{Foobar}n: ignored (do Handlers communicate anything usefull??)
%...{Foobar}o: use response.getField("Foobar")
%...p: use request.getPort()
%...P: don't know is there a System.getProperty("java.process.id")?
%...q: use request.getQuery()
%...r: don't know
%...s: don't know use response.getStatus()??
%...t: use request.getTimeStamp() and java.util.Calendar et.al.
%...T: don't know maybe request.getTimeStamp() with System.currentTimeMillis()?
%...u: use request.getAuthUser() (or request.getUserPrincipal().getName()??)
%...U: use request.getRequestURL()
%...v: use request.getHost() ??
%...V: use request.getHost() ??

If anybody could assist and let me know if any of my assumptions are wrong
or knows how to get at the missing information, I'd be gratefull :-)
Once this is finished and tested, would anybody else be interested in it?
If yes, I could donate it to Jetty if someone would explain the procedure.
Regards, Chris.
--
"Our enemies are innovative and resourceful and so are we. They never stop
thinking about new ways to harm our country and our people and neither do we."
President Bush at the signing of H.R. 4613, August 5th, 2004.


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise