Back to project page AndroidAppLog.
The source code is released under:
Apache License
If you think the Android project AndroidAppLog listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package me.allenz.androidapplog; // w ww. jav a 2s .c o m import java.lang.Thread.UncaughtExceptionHandler; public class UncaughtExceptionLogger implements UncaughtExceptionHandler { private UncaughtExceptionHandler mDefaultExceptionHandler; public UncaughtExceptionLogger() { this(Thread.getDefaultUncaughtExceptionHandler()); } public UncaughtExceptionLogger( final UncaughtExceptionHandler uncaughtExceptionHandler) { this.mDefaultExceptionHandler = uncaughtExceptionHandler; } @Override public void uncaughtException(final Thread thread, final Throwable ex) { final Logger logger = LoggerFactory.getLogger(ex.getStackTrace()[0] .getClassName()); logger.error(ex, "Uncaught exception in thread [%s] :", thread.getName()); if (mDefaultExceptionHandler != null) { mDefaultExceptionHandler.uncaughtException(thread, ex); } } public UncaughtExceptionHandler getDefaultExceptionHandler() { return mDefaultExceptionHandler; } }