You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Goodenough <da...@btconnect.com> on 2010/08/20 11:43:33 UTC

logging from a filter

How do I write log entries from a Filter.  In a servlet there is a log method
but as a filter only implements Filter that is obviously not an option.

David

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


Re: logging from a filter

Posted by David Goodenough <da...@btconnect.com>.
On Friday 20 August 2010, Rainer Jung wrote:
> On 20.08.2010 11:43, David Goodenough wrote:
> > How do I write log entries from a Filter.  In a servlet there is a log
> > method but as a filter only implements Filter that is obviously not an
> > option.
> 
> The init() of the filter is called with a FilterConfig argument, from
> which you get a ServletContext via getServletContext(), which you can
> store locally. The ServletContext then has the log methods you want.
thanks.  Exactly what I needed.

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


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


Re: logging from a filter

Posted by Rainer Jung <ra...@kippdata.de>.
On 20.08.2010 11:43, David Goodenough wrote:
> How do I write log entries from a Filter.  In a servlet there is a log method
> but as a filter only implements Filter that is obviously not an option.

The init() of the filter is called with a FilterConfig argument, from 
which you get a ServletContext via getServletContext(), which you can 
store locally. The ServletContext then has the log methods you want.

Regards,

Rainer

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