DefaultExceptionHandler logs warning cannot be disabled [SPR-17628] #22159
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
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
The text was updated successfully, but these errors were encountered: