Java Exception Listener

前端 未结 2 1672
后悔当初
后悔当初 2020-12-20 18:23

Is there a way to listen any exceptions in java?

My purpose is creating a library that listens & collects all rised errors in java. Are there any way to do this?

2条回答
  •  臣服心动
    2020-12-20 19:16

    You can catch every uncaught exception via Thread.UncaughtExceptionHandler. If that's not sufficient I would perhaps suggest some AOP/bytecode-weaving solution to implement some watch around each created exception.

提交回复
热议问题