I have a small application with multiple threads with GUI and sockets. During development, I found that sometimes there are a few exceptions that are not caught and are not logged into the system . I have to look at the console to get them, if any.
Is there a way to catch these uncaught exceptions from different threads (including EDT) in one place, speaking in main () and writing them down? I put try-catch in main () to catch Throwable , but it does not work.
EDIT:
More specifically, I have Executors.newCachedThreadPool () with Runnable . I do not want to use Callable in many cases, because I do not want to block my calling thread. Then how can I catch exceptions from these Runnables?
And also how can I catch the ncaught exception from Swing EDT ?
source share