You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Mark Womack <mw...@bevocal.com> on 2002/12/16 21:10:59 UTC

Cookie -> MDC servlet 2.3 filter

Based on the servlet thread that occurred last week, I wrote this servlet
2.3 filter which can be configured to place the values of request cookies
into the log4j MDC.  You can then configure your web application to run this
filter before a set of servlets/jsps.  This will "automatically" set up the
log4j MDC information before the request is processed.  Once the information
is in the log4j MDC, you can then configure log4j to print it out as part of
the log messages.  Anything that is stored in a cookie can be handled in
this way.

I am submitting this code for inclusion in the new org.apache.log4j.servlet
package, which is expected to be released as part of log4j v1.3.  But folks
can start using it now.

If anyone has feedback, please post it so that it can be reviewed and
incorporated.

If anyone has other useful filters or servlet related code they have written
to support the use of log4j, please consider posting it for possible
inclusion.

Thanks,
-Mark

 <<CookieMDCFilter.zip>>