質問

I suspect a thread created by a third-party jar used by my web application may be throwing an exception, and not catching it. However, I don't see any evidence of this in the log files. How can I force all uncaught exceptions to be dumped to a log file? This is for a web app running inside Glassfish.

役に立ちましたか?

解決 3

It turns out that this is not necessary with Glassfish, because Glassfish already does it - but I was looking at the wrong place in the logs.

The exception was printed to the main server.log file - not to my application's own log4j log file.

他のヒント

You can set a default uncaught exception handler using Thread's setDefaultUncaughtExceptionHandler static method:

Thread.setDefaultUncaughtExceptionHandler( new Thread.UncaughtExceptionHandler() {
            public void uncaughtException( final Thread t, final Throwable e ) {
                ...
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top