-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d941731
commit c282367
Showing
3 changed files
with
18 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
package org.jabref; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.apache.logging.log4j.Marker; | ||
import org.apache.logging.log4j.MarkerManager; | ||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
|
||
/** | ||
* Catch and log any unhandled exceptions. | ||
*/ | ||
public class FallbackExceptionHandler implements Thread.UncaughtExceptionHandler { | ||
|
||
private static final Marker UncaughtException_MARKER = MarkerManager.getMarker("UncaughtException"); | ||
private static final Log LOGGER = LogFactory.getLog(FallbackExceptionHandler.class); | ||
|
||
public static void installExceptionHandler() { | ||
Thread.setDefaultUncaughtExceptionHandler(new FallbackExceptionHandler()); | ||
} | ||
|
||
@Override | ||
public void uncaughtException(Thread thread, Throwable exception) { | ||
Logger logger = LogManager.getLogger(FallbackExceptionHandler.class); | ||
logger.error(UncaughtException_MARKER, "Uncaught exception Occurred in " + thread, exception); | ||
LOGGER.error("Uncaught exception occurred in " + thread, exception); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters