tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From his...@hadv.nl
Subject Re: quick Tomcat question
Date Fri, 02 Feb 2001 09:04:43 GMT


I just migrated to tomcat4. It features an access log. From the tomcat 4
documentation (filters.html):

- - - - - - - - - - - - - - - -
3.3.1 Access Log Creation
When running Tomcat behind a web server, the web server is responsible for
creating the "access log" file that is typically used by hit count analysis
programs.
However, when you are running Tomcat stand-alone, it would be nice if Tomcat
could optionally include functionality to perform this task for us.
(Such a Valve already exists in Catalina).

To implement this functionality as a RequestInterceptor, we might create
something like this:

    public final class AccessLogInterceptor extends BaseInterceptor {

        public int postService(Request request, Response response) {
         ... log the interesting details ...
     }

    }

A corresponding Valve implementation would look like this:

    public final class AccessLogValve extends ValveBase {

        public void invoke(Request request, Response response)
       throws IOException, ServletException {
         getNext().invoke(request, response);
         ... log the interesting details ...
     }

    }

As you can see, both approaches can easily implement the required functionality.
The only important difference is that the Valve must specifically decide to call
the next valve in the pipeline (as described under "Valve Basics" above), while
filter management in the RequestInterceptor environment is the responsibility of
the container itself. What is not visible here, however, is the fact that the
container is also calling the other nine entry points of AccessLogInterceptor,
even though they do nothing at all useful.

- - - - - - - - - - - - - - -

Hope this helps,

Wilko






"Billford" <billford@billford.com> on 02-02-2001 00:35:55

Please respond to tomcat-user@jakarta.apache.org

To:   tomcat-user@jakarta.apache.org
cc:    (bcc: Wilko Hische/HADV/NL)
Subject:  quick Tomcat question



I have a site in Tomcat,  I have no need for Apache as ALL of the pages are
dynamic via JSP, servlets, whatever.  At any rate,  I need to have an access_log
type file to log access to the site. I'd like to be able to do this without
installing Apache and the connectors.  Does anyone know how to do this?  I can't
seem to find any info on it.   Thanks in advance.

Bill

Mime
View raw message