PDA

View Full Version : How to tell Tomcat not to log certain requests?


blender
21-11-2008, 14:56
Hi All,

There are certain requests that I don't want written to the AccessLog.

In Apache (httpd.conf) I can achieve this by:

SetEnvif Remote_Addr [regex] dontlog

CustomLog logs/access_log combined env=!dontlog

How do I achieve the same in Tomcat?

Thanks!

Jason

kjkoster
21-11-2008, 20:41
Hi Jason,

I don't think Tomcat supports this.

Could you please elaborate on what you want to do? Keep the logs short? Hide certain requests?

What you could do is write your own access log valve. But maybe that's a bit too much. Or you could stick Tomcat behind Apache and log there instead of in Tomcat.

Kees Jan

blender
21-11-2008, 20:56
Hi Jason,

I don't think Tomcat supports this.

Could you please elaborate on what you want to do? Keep the logs short? Hide certain requests?

Kees Jan

The basic problem was that the server was behind a pair of BIG-IPs that were doing health checks as a HTTP GET request. Fortunately was able to change the check to a TCP check.

Still I searched and searched for an analogous solution in Tomcat like the one available in Apache (there's also piped logs in Apache) and was kind of surprised that a de facto solution doesn't seem to exist in Tomcat/Coyote.

Thanks!

Jason

kjkoster
21-11-2008, 22:47
Dear Jason,

I see. Glad you found a work-around.

Kees Jan