> -----Original Message----- > From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Sent: Tuesday, July 22, 2014 11:06 AM > To: Tomcat Users List > Subject: Re: Conditional logging > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Kris, > > On 7/22/14, 10:22 AM, Dames, Kristopher J wrote: > >> > >> Kris, > >> > >> On 7/21/14, 6:43 PM, Dames, Kristopher J wrote: > >>> Can anyone point me to an example of conditional logging in > >>> Tomcat 6? Here is what I have tried to no avail. I want > >>> requests that match /*/iaahb to not be logged. > >>> > >>> In my server.xml: > >>> > >>> <Valve className="org.apache.catalina.valves.AccessLogValve" > >>> condition="DoNotLog" directory="logs" > >>> fileDateFormat="yyyy-MM-dd" pattern="%{X-Forwarded-For}i %h %l > >>> %u %t "%r" %s %b "%{Referer}i" > >>> "%{User-Agent}i"" > >>> > >>> prefix="access_log"/> > >>> > >>> in my web.xml: > >>> > >>> <!-- Custom filter to prevent logging health check requests > >>> --> <filter> <filter-name>Set Do Not Log > >>> Attribute</filter-name> > >>> <filter-class>SetDoNotLogFilter</filter-class> <init-param> > >>> <param-name>DoNotLog</param-name> > >>> <param-value>true</param-value> </init-param> </filter> > >>> <filter-mapping> <filter-name>Set Do Not Log > >>> Attribute</filter-name> <url-pattern>/*/iaahb</url-pattern> > >>> </filter-mapping> > >> > >> On the face of it, this looks like it should work. What does > >> your "SetDoNoLogFilter" code look like? > >> > >> - -chris > > > > > > Perhaps that's my problem, I do not have any code to support this. > > I think for this to work as I have it now I need an existing Java > > filter class. > > Hah. Okay, so then what does "SetDoNotLogFilter" refer to? Or were you > just hoping that would magically work?
Yes, I was hoping for a little magic. Conditional logging seems like such a basic concept that I am greatly surprised to have to jump through hoops to achieve it. The documentation I've read for filters seems to be intended for an audience with prior webapp development experience. Unfortunately I do not fall into that crowd, so I was unaware a filter had to be related to another piece of configuration/code. I am looking into the url-rewrite filter as suggested. Thanks! -- Kris Dames > > Mark's response was prescient: you probably want to use the > url-rewrite filter because it will avoid you having to write any new > code. > > - -chris This electronic mail and any attached documents are intended solely for the named addressee(s) and contain confidential information. If you are not an addressee, or responsible for delivering this email to an addressee, you have received this email in error and are notified that reading, copying, or disclosing this email is prohibited. If you received this email in error, immediately reply to the sender and delete the message completely from your computer system.