在慢速设备上出现 STRICT MODE 异常:
D/StrictMode: StrictMode policy violation; ~duration=494 ms: android.os.StrictMode$StrictModeDiskWriteViolation: policy=87 violation=1
at android.os.StrictMode$AndroidBlockGuardPolicy.onWriteToDisk(StrictMode.java:732)
at dalvik.system.BlockGuard$WrappedFileSystem.write(BlockGuard.java:170)
at java.io.FileOutputStream.write(FileOutputStream.java:300)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:164)
at org.apache.log4j.helpers.QuietWriter.flush(QuietWriter.java:59)
at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:324)
at org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:276)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.debug(Category.java:260)
在主线程中的第一个日志记录操作上。我将 log4j 与.RollingFileAppender
它是否写入主线程中的文件?在我看来这很奇怪......我如何强制log4j
从其他线程而不是主线程写入日志文件?