Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@www.apache.org Received: (qmail 86238 invoked from network); 2 Oct 2003 17:09:39 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 2 Oct 2003 17:09:39 -0000 Received: (qmail 75633 invoked by uid 500); 2 Oct 2003 17:09:24 -0000 Delivered-To: apmail-jakarta-tomcat-dev-archive@jakarta.apache.org Received: (qmail 75577 invoked by uid 500); 2 Oct 2003 17:09:23 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 75564 invoked from network); 2 Oct 2003 17:09:23 -0000 Received: from unknown (HELO smtp.easystreet.com) (206.26.36.40) by daedalus.apache.org with SMTP; 2 Oct 2003 17:09:23 -0000 Received: from apache.org (dsl-208-161-106-6.dsl.easystreet.com [208.161.106.6]) by smtp.easystreet.com (Postfix) with ESMTP id 6BA2184532C for ; Thu, 2 Oct 2003 10:09:27 -0700 (PDT) Message-ID: <3F7C5B8A.2020402@apache.org> Date: Thu, 02 Oct 2003 10:08:26 -0700 From: "Craig R. McClanahan" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Developers List Subject: Re: Logging filter (was RE: [next] What's next ?) References: <20031002161704.17093.qmail@web20421.mail.yahoo.com> In-Reply-To: <20031002161704.17093.qmail@web20421.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N joe user wrote: >--- "Shapira, Yoav" wrote: > > >>1. Convert AccessLogValve to be a servlet >>specification 2.3 filter, i.e. >>something portable. We can define it in >>$CATALINA_HOME/conf/web.xml, >>commented out by default perhaps, and users can move >>the definition >>around as they need just like they do with the >>servlets defined >>conf/web.xml. >> >>Furthermore, people can then extend/customize >>AccessLogFilter much more >>easily, without needing to touch any tomcat classes. >> And finally, this >>will allow the full power of filter-mapping to be >>applied to access >>logging. (I imagine the default in conf/web.xml >>would be the /* >>url-pattern mapping, but I know I and other users >>have different use >>cases). >> >>If you think this is useful, I'd like to start >>working on it myself ;) >>If you think it's not useful/bad/stupid, please let >>me know ;) >> >> > >That sounds wonderful and useful, but there are a few >problems here. Filters don't have access to all the >information that is needed to make a log entry the way >the AccessLogValve does it. Content length, response >code and content type variables may not be known when >the filter is processing, and (last time I checked) >there is no byte[] Response.getContentType() method. >There is setContentType() but no getContentType(). > > Easily solved by having the filter add a response wrapper that provides access to the needed information. There's a jakarta-commons sandbox package called "filters" that was originally designed to be a home for general purpose Filters like this. If you want to experiment with creating Filter implementations of some things that are currently Valves in Tomcat, that would be a good place to do it. For access logging in particular, I'd be concerned about a couple of things: * Filters don't see every request (for example, the authentication challenges when you're using BASIC authentication). * Filters only see the requests for their particular webapp. * Filters require the webapp to be configured itself to enable them, versus the current approach where access logging is a container configuration issue. Craig --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org