Search code examples
javaexceptionlistener

Java Exception Listener


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?


Solution

  • 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.