tomcat-users mailing list archives

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

Leo,

On 3/29/2011 5:44 PM, Leo Donahue - PLANDEVX wrote:
>> -----Original Message-----
>> From: Christopher Schultz [mailto:chris@christopherschultz.net]
>> 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.

Hmm...

>>> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2TRmcACgkQ9CaO5/Lv0PAIBQCfeDY2N9qXHbuijqz5cIOSnkj8
POgAn0ghVWuAkkiEv3cTrOTWsyCRe4IB
=c7cf
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message