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

DefaultExceptionHandler logs warning cannot be disabled [SPR-17628] #22159

Closed
spring-issuemaster opened this issue Dec 28, 2018 · 1 comment
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Dec 28, 2018

danielrohe opened SPR-17628 and commented

Before the change the warn logger was not enabled for DefaultHandlerExceptionResolver and it only logged on warn level in case the exception was one of ConversionNotSupportedException, TypeMismatchException, HttpMessageNotReadableException, HttpMessageNotWritableException.

With the latest changes from #21916 the DefaultHandlerExceptionResolver warn logger got enabled by default in the constructor and can't be disabled (setting to null in Configuration class causes NPE). This leads to the state that all resolved exceptions are logged at warn level in AbstractHandlerExceptionResolver logException method. So not only the exceptions mentioned above but also HttpRequestMethodNotSupportedException, HttpMediaTypeNotSupportedException, HttpMediaTypeNotAcceptableException, MissingPathVariableException, MissingServletRequestParameterException, ServletRequestBindingException, MethodArgumentNotValidException, MissingServletRequestPartException, BindException, NoHandlerFoundException.

Can you please clarify what is the logging behavior of DefaultHandlerExceptionResolver?

In my opinion warn logging in this class should also be configurable and not enabled by default. So that developers are free to choose whether they want to have it disabled or enabled. As a side note: it should also honor the application property spring.mvc.log-resolved-exception


Affects: 5.1.3

@rstoyanchev

This comment has been minimized.

Copy link
Contributor

@rstoyanchev rstoyanchev commented Jan 18, 2019

In #21714 DefaultHandlerExceptionResolver was updated to consistently log all exceptions. So that's expected behavior, but I'll fix the NPE so it can be disabled. Also you can use the protected method logException.

@rstoyanchev rstoyanchev changed the title DefaultExceptionHandler logs warnings for any exception [SPR-17628] DefaultExceptionHandler logs warning cannot be disabled [SPR-17628] Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.