elvishew/xLog

在UncaughtExceptionHandler中无法打印到文件

howtoplay opened this issue · 2 comments

如题,我设置了一个全局的CrashHandler实现了UncaughtExceptionHandler,但是无法将日志打印到文件,可以打印到logcat

找到原因了,是因为使用了Worker线程,在CrashHandler中把变量USE_WORKER设为false,具体可以修改源码,在FilePrinter的Builder中增加设置

public Builder useWorker(boolean USE_WORKER) { this.USE_WORKER = USE_WORKER; return this; }

找到原因了,是因为使用了Worker线程,在CrashHandler中把变量USE_WORKER设为false,具体可以修改源码,在FilePrinter的Builder中增加设置

public Builder useWorker(boolean USE_WORKER) { this.USE_WORKER = USE_WORKER; return this; }

@howtoplay Maybe you can just wait for a while within your CrashHandler, so the logging worker have enough time to write log file