What is according to you the simplest way to intercept all exceptions in a Java application? Would AOP be needed to provide this kind of functionality or can it be done with dynamic proxies or is there another way? Is the simplest solution also a good solution regarding impact on execution performance? I would like to hear possible solutions from more experienced developers as I'm trying to grasp the technical know-how about the subject.
EDIT:
Thanks for the good advice already, but doesn't the current advice only apply to checked exceptions? What about unchecked exceptions, like NullPointerExceptions, wouldn't it be useful if these could be caught and that the application on catching them dumps the heap/stack to provide you with the current context of the application at the moment of crashing?