Android 如何从 logcat 中删除旧数据?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2657348/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:47:49  来源:igfitidea点击:

How can I erase the old data from logcat?

androidandroid-emulatorlogcat

提问by aarona

When I execute the command

当我执行命令时

adb logcat

adb logcat

while running the android emulator, all of the old logs blow past and so I figure they are stored in a file somewhere. Is there a command I can run to clear the logs and start fresh? If not, is there some other way to do this?

在运行 android 模拟器时,所有旧日志都过去了,所以我认为它们存储在某个文件中。有没有我可以运行的命令来清除日志并重新开始?如果没有,有没有其他方法可以做到这一点?

回答by Bob

adb logcat -c 

didn't do it for me

不是为我做的

adb logcat -b all -c

worked

工作过

回答by Lava Sangeetham

Dup of How to empty (clear) the logcat buffer in Android

Dup 如何清空(清除)Android 中的 logcat 缓冲区

The following command will clear only non-rooted buffers (main, system ..etc).

以下命令将仅清除非根缓冲区(主、系统 .. 等)。

adb logcat -c

If you want to clear all the buffers (like radio, kernel..etc), Please use the following commands

如果要清除所有缓冲区(如收音机、内核等),请使用以下命令

adb logcat -b all -c

or

或者

adb root
adb shell logcat -b all -c 

回答by Tarun

For me, adb logcat -cwas not working and was giving following error :

对我来说,adb logcat -c无法正常工作并出现以下错误:

failed to clear the 'main' log

For this, I first did :

为此,我首先做了:

adb shell

Than I did :

比我做的:

logcat -c

then exit the shell. This way I was able to clear logcat when same was not getting cleared from adb logcat -c

然后退出外壳。这样我就可以在没有从 adb logcat -c 中清除 logcat 时清除 logcat