Announcement Announcement Module
No announcement yet.
MessageDispatcher - exception logging Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • MessageDispatcher - exception logging

    I have 2 kinds of exceptions returned from my service implementations:
    1. unexpected exceptions (eg. NullPointerException), and
    2. exceptions which are normal and expected outcomes of the business logic function (eg. NoMoreMoneyOnAccountException)
    (I think this is a general pattern of using exceptions)

    expected exceptions are handled by my custom ExceptionResolver
    and unexpected exceptions are handled by the standard SimpleSoapExceptionResolver

    "unexpected" exceptions should be logged at WARN (or ERROR) level
    because they indicate some problem in the system

    "expected" exceptions should either not be logged, or logged at DEBUG level
    because they are normal and expected outcome of the business logic function, they do not indicate problem in the system

    unfortunately the MessageDispatcher class (the processEndpointException() method) logs all exceptions at WARN level
    and this can not easily be customized

    shouldn't it be possible to customize somehow the exception logging functionality?
    it is quite disturbing to have all the expected and normal exceptions being logged at WARN level

  • #2
    One approach is to do your own logging in the exception resolver. To make this easier, I set the log level from WARN to DEBUG, which seemed more appropriate and consistent with the Spring-MVC DispatcherServlet.