tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Logging request parameters - Filter vs Servlet
Date Wed, 30 Mar 2011 15:04:08 GMT
Hash: SHA1


On 3/29/2011 5:44 PM, Leo Donahue - PLANDEVX wrote:
>> -----Original Message-----
>> From: Christopher Schultz []
>> Subject: Re: Logging request parameters - Filter vs Servlet
>> On 3/29/2011 12:57 PM, Leo Donahue - PLANDEVX wrote:
>>> Where do you initialize the Logger (Filter or Servlet)?
>> Which logger?
> I don't know what I don't know... Log4j I guess.  That is what everyone recommends.


>>> The servlet 2.5 spec says you can use filters for logging, but since
>>> I'm not modifying the request or response, is logging from within a
>>> filter the right approach to logging request parameters?
>> That depends upon your requirements. What are they?
> I just want to capture the request parameters on a certain web app 
> and log them (time and what they were) in a separate log file from
> the standard logs, so that I don't have to hunt them down in the
> standard Tomcat logs. The security tool that our telecom office uses
> for auditing our sites makes quite a mess of my standard logs
> periodically.

There is an AccessLogValve that you can use if you know which request
parameters you want to log. There is also a RequestDumperValve (and
RequestDumperFilter in 7.0) that you can use to dump everything from the
request. See the docs for details.

Would those work for you?

>> Note that reading request parameters in a Filter may trigger parsing of
>> a POST request body which may not be something you want to happen on
>> every request.
> An example of things I don't know that I don't know...

Heh. I suppose you'll know if things stop working.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


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

View raw message