Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractRequestLoggingFilter and CommonsRequestLoggingFilter log level checks [SPR-12609] #17210

Closed
spring-issuemaster opened this issue Jan 9, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Jan 9, 2015

stephane cizeron opened SPR-12609 and commented

Hello,
The AbstractRequestLoggingFilter is very usefull but the perfomances could be improved. In fact, when a request is coming, a request message is created and after that, the log level check is done. Most of the time, the request message is useless. It's the same case for the response message (the "after request" message exactlty).

You could add the log level test :

protected void doFilterInternal(...) throws ServletException, IOException {
...
if (isFirstRequest && logger.isDebugEnabled()) {
beforeRequest(requestToUse, getBeforeMessage(requestToUse));
}
...
if (!isAsyncStarted(requestToUse) && logger.isDebugEnabled()) { afterRequest(requestToUse, getAfterMessage(requestToUse));
}

Regards
Stephane


Affects: 4.1.4

Referenced from: commits d4dac25, bfba988

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 20, 2015

Juergen Hoeller commented

Addressed through the introduction of a protected shouldLog template method, overridden for Commons Logging with a logger.isDebugEnabled check.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.