I have a not small multiple threads application with GUI and socket communications. During the development, I found sometimes there are some exceptions are not caught and logged. I have to stare at the console to get them if there is any.
Is there a way to catch those uncaught exceptions from different threads (including EDT) in one place, saying in main(), and log them? I do put a try-catch in main() to catch the Throwable but it doesn't work.
EDIT:
More specific, I have Executors.newCachedThreadPool() with Runnables. I don't want to use Callable in many cases because I don't want to block my calling thread. Then how can I catch exceptions from those Runnables?
And also how can I catch uncaught exception from the Swing EDT?