Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-17628

DefaultExceptionHandler logs warnings for any exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.1.3
    • Fix Version/s: Waiting for Triage
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      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 SPR-17383 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

        Attachments

          Activity

            People

            Assignee:
            rstoya05-aop Rossen Stoyanchev
            Reporter:
            danielrohe danielrohe
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              3 years, 24 weeks, 1 day ago