Repository navigation
Add the minRequestDuration attribute to the access log valves - #1172
Open
arturobernalg wants to merge 1 commit into
Open
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
Requests that take less time than the configured number of milliseconds are not logged. This allows a second access log valve to log only the slow requests. The default of zero logs every request. The check uses the time that is already passed to log() so nothing is formatted for the requests that are skipped. It is applied in addition to conditionIf and conditionUnless.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
minRequestDurationattribute, in milliseconds, to the access log valves (AccessLogValve,ExtendedAccessLogValveandJsonAccessLogValve). Requests that take less time are not logged, so a second access log valve can be used to keep a log of only the slow requests. A request that takes exactly the configured time is logged. The default of0logs every request, as before.The check uses the time that is already passed to
log(), in nanoseconds, and is done before anything is formatted, so skipped requests cost almost nothing. It is applied in addition toconditionIfandconditionUnless, which cannot filter on the duration without a custom filter that sets a request attribute. A negative value is rejected.Tests:
TestAccessLogValveMinRequestDuration, which passes the time to the valve so it does not have to wait, and the existing access log tests. Also run against a running Tomcat with a normal and a slow access log, HTTP/1.1 and HTTP/2, async requests, 404 and 500 responses, comparing with main.