-
Notifications
You must be signed in to change notification settings - Fork 38.5k
ExceptionHandlerExceptionResolver should not log propagated exceptions at warn level [SPR-14907] #19473
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
Comments
Juergen Hoeller commented Good point, rethrowing the original exception is indeed a valid use case. Note, however, that we're not going to process the actual rethrown exception; we just take it as an indication that default processing needs to be applied to the original exception. So if any other than the original exception comes out of such a handler method, we're going to log a warning still... but not for the original exception itself anymore. |
Eric Deandrea commented That sounds ok as long as at the end of the day if my application throws some RuntimeException that is annotated with |
Juergen Hoeller commented That is certainly the case now. We only really intended to log a warning for accidental exceptions coming out of a handler method, e.g. assertion failures within the exception handler method itself. Rethrowing the original exception (no matter whether with or without |
Eric Deandrea commented Thanks a bunch! |
dfreudenberger commented It seems like we have the same issue again since spring-webmvc-5.0.9.RELEASE. The regression was introduced with this commit 04141de#diff-4386c732a724a039db2007b1bac7d3d5R141. Happy to be wrong but as of right now I don't see how I can get rid of the warning without raising the logging threshold for the package / class to error. |
pebo commented I face the same issue in spring boot 2.0.6 (5.0.10.RELEASE of web mvc) |
Juergen Hoeller commented pebo, this is an unfortunate regression that we're tracking in #21916. Should be fixed in the latest |
Uh oh!
There was an error while loading. Please reload this page.
Eric Deandrea opened SPR-14907 and commented
In spring-webmvc - org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver line 386 was changed from a logger.debug in version 4.3.3 (line 384 in version 4.3.3) to logger.warn in version 4.3.4. This might not seem like a big deal but is causing lots of non-necessary stack traces in our applications.
We have a FaultBarrier implemented as a SpringMVC
@ExceptionHandler
method, implemented as below. Basically its a generic handler that catches all exceptions. If the exception itself is annotated with@ResponseStatus
, we simply re-throw it & let SpringMVC handle it. Now as of version 4.3.4 this is logging warning exception stack traces to our logs which is triggering out paging system to page people (our system pages out if any stack traces appear as WARN or ERROR levels), even though most of the exception codes in the@ResponseStatus
are 400 series exceptions and are not error conditions at all. Our only fix so far is to downgrade back to 4.3.3.Here's the stack trace it generates:
Affects: 4.3.4
Issue Links:
@ExceptionHandler
at higher level than debug@ExceptionHandler
Referenced from: commits 96bfc14, f22a4a4
The text was updated successfully, but these errors were encountered: