How can I detect when an Exception's been thrown globally in Java?

后端 未结 10 450
自闭症患者
自闭症患者 2020-11-30 02:30

How can I detect when an Exception has been thrown anywhere in my application?

I\'m try to auto-magically send myself an email whenever an exception is thrown anywhe

10条回答
  •  失恋的感觉
    2020-11-30 03:01

    If you are using java 1.3/1.4, Thread.UncaughtExceptionHandler is not available. In this case you can use a solution based on AOP to trigger some code when an exception is thrown. Spring and/or aspectJ might be helpful.

提交回复
热议问题