tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: Logging filter (was RE: [next] What's next ?)
Date Thu, 02 Oct 2003 16:56:36 GMT

There's already an exposed API for writing tomcat loggers (just
implement org.apache.catalina.Logger and configure your logger in
server.xml).  Let's get off that topic please and stick to the access
log filter I was proposing.

>I think that many of those values, such as
>ContentLength, are not known until all the webapp
>stuff is completely done touching the response.  The

This is true.  This stuff, and the access log record, would be written
on the outgoing part of the filter, i.e. (abbreviated form)

doFilter(ServletRequest req, ServletResponse res, FilterChain chain) {
  ... Start new log record ...
  ... Enter request parameters into log record ...
  ... chain.doFilter(req, res);  // After this, response is done
  ... Gather response parameters for log record
  ... Write log record to file

But your also make an interesting point about errors during the
response.  The chain.doFilter method throws IO and Servlet exceptions.
Perhaps they could be caught in the filter, logged, and thrown again
after the log record is written?

Yoav Shapira

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message