Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

日志文件内容刷新延迟 #73

Open
XianRenn opened this issue Jun 29, 2021 · 2 comments
Open

日志文件内容刷新延迟 #73

XianRenn opened this issue Jun 29, 2021 · 2 comments

Comments

@XianRenn
Copy link

    LogUtils.getLog2FileConfig().configLog2FilePath("/sdcard/logs").
            configLog2FileEnable(true).
            configLogFileEngine(new LogFileEngineFactory(this));
    Intent intent = new Intent(this, MainActivity.class);
    LogUtils.e(intent);

以上是我的代码,运行完之后再logcat正常输出了。去查看日志文件,文本文件为空,大概过了三分钟之后,日志文件里面才有这个数据

@pengwei1024
Copy link
Owner

这是 mmap 的机制,不会即时写入文件,这也是性能比较好的主要原因。如果希望立即写入,可以主动调用 flush,或者杀进程重启也会马上写入

@tinybright
Copy link

tinybright commented Dec 2, 2022

在adb logcat >a.log里 显示为乱码是不是也是这个原因

12-02 18:38:51.377 14075 14075 E LogUtils鉃? 鈺熲攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€
12-02 18:38:51.377 14075 14075 E LogUtils鉃? 鈺?test-start app4 24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants