Tomcat 7: Filter access log
I'd like to know if there is a way to filter/supress entries from getting logged in the access log in Tomcat 7. Our logfile is groing rapitly and we'd like to know if we can filter out entries so the file doesn't grow as fast as it is doing right now.
We use the Access Log Valve as described in the Tomcat configuration documentation. The entry looks like this:
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="lo开发者_JAVA技巧gs" prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" resolveHosts="false" />
You can use "condition" attribute to filter out requests based on request attributes.
Details : http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html#Access_Log_Valve/Attributes
You can subclass "org.apache.catalina.valves.AccessLogValve" to implement more specific filter.
精彩评论