How do you log an uncaught exception in Java? <p>My client is testing my beta phase Java application on a data that he cannot provide me with (privacy reasons). Although I implemented the handling of most exceptions, application crashes on rare occasions.</p> <p>Can I log the stacktrace of an uncaught exception to a file so that tester can provide me with it(e.g. <code>NullPointerException</code>)?</p>