繁体   English   中英

在命令行上过滤Logcat日志

[英]Filtering Logcat Logs on commandline

public static final TAG = "Legendry Eagle";

问题:我想"Legendry Eagle"查看"Legendry Eagle"日志。

我试过了:

 adb logcat -s "Legendry Eagle" 
 adb logcat -s <Legendry Eagle>

但是仍然无法正常工作。

如果只想显示特定TAG的logcat,请执行以下操作:

adb logcat YourTAGHere:Priority *:S

*:S很重要,因为它将所有其他标签设置为静默。 如果我只想在详细级别跟踪我的MainActivity标记,则语法应如下所示。

adb logcat MainActivity:V *:S

编辑:我发现没有很好的方法来过滤带有空格的标签。 LegendryEagle工作正常,但是我无法过滤掉Legendry Eagle

如果标准的adb logcat -s tagname不起作用,则始终可以通过管道将adb的输出通过管道find以过滤所需的内容,例如

adb logcat | find "Legendry Eagle"

这会将整个logcat传递给DOS find命令,该命令反过来过滤掉包含Legendry Eagle字符串的行。

adb logcat | grep "your tag"

仅显示带有“您的标签”的日志

答案很简单。 请删除两个单词之间的空格,然后重试。

 public static final TAG = "LegendryEagle";
 adb logcat -s "LegendryEagle" 

并查看logcat。 你得到了答案。

使用此命令adb logcat *:W并阅读此内容。 http://developer.android.com/tools/debugging/debugging-log.html

假设您使用Eagle作为日志记录标记,请使用以下命令:

亚行logcat Eagle:* *:s

据我了解,Eagle:*表示打开Eagle标记的所有日志,而*:s表示使所有其他标记保持静音

我个人发现eclipse logcat视图比命令行更易于使用,它对于不同级别的日志具有不同的颜色,并且您可以创建一个过滤器并将其保存,它将一直保存在那里,直到您删除该过滤器为止

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM