Announcement Announcement Module
Collapse
No announcement yet.
How to obtain exceptions thrown from custom destroy-methods Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to obtain exceptions thrown from custom destroy-methods

    Hi,

    If a destroy-method throws an exception when you closes the application context using ApplicationContext.close(), then the exception is swallowed by Spring. Hence the exception will be silently ignored.
    If I enable Spring debug-logging, I'll see a warning like this: [WARN] DisposableBeanAdapter - Invocation of destroy method 'destroy' failed on bean with name 'service'.
    But enabling Spring debug-logging is not an option in a production system as it produces far to much logging, and we want to generate the logging ourself.

    Is there any other way to obtain such exceptions?

    I'm thinking about something like 'List<Exception> getDisposableException()' which might be invoked after ApplicationContext.close().

    Or, if anyone have any other tricks?

    Regards,
    Peder

  • #2
    What is wrong with simply enabling debug logging for DisposableBeanAdapter only? You don't have to enable debug logging for everything.

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      What is wrong with simply enabling debug logging for DisposableBeanAdapter only? You don't have to enable debug logging for everything.
      That's a point, but in general we don't want to use the Spring logging. We have built our own application server and want consistent logging.

      Comment

      Working...
      X