处理 logcat 中的空格

问题描述 投票:0回答:2

我的应用程序使用的外部库之一的 logcat 标记中有空格:

Log.d("Some External Library", "Debug Message");

如何在 logcat 命令中编写过滤器规范来处理空格? Eclipse 内的 Logcat 能够过滤它,但我更喜欢命令行。

我已尝试以下方法,但不起作用:

adb logcat -s "Some External Library"
adb logcat -s Some\ External\ Library
adb logcat -s Some External Library
android logcat
2个回答
7
投票

所以我的建议是使用管道。写:

adb logcat | grep 'Some External Library'

也许其他人有其他想法。

如果您只需要调试消息,请写

adb logcat '*:D' | grep 'Some External Library'
对于更多可能的标签,请写
adb logcat --help

问题是,您无法在

adb shell
环境中使用此解决方案,因为那里的文件系统是只读的。但这个解决方案应该会给你或多或少你想要的结果。

adb logcat -s 'Some external Library'

logcat -s '"Some External Library":D'
这样的命令不起作用。


0
投票

这是一个已知的错误。

https://issuetracker.google.com/issues/339670475

希望你在 13 年前就报告了这件事,但是。

© www.soinside.com 2019 - 2024. All rights reserved.