开发者

Tomcat 7: Filter access log

开发者 https://www.devze.com 2023-04-10 00:38 出处:网络
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 th

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 &quot;%r&quot; %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.

0

精彩评论

暂无评论...
验证码 换一张
取 消