问题描述
是否还可以在每行中显示日志的包名称?
使用
Is it possible to also display the Log's Package Name in each line?
Using
将包名字段(在PID之后)准确留为空白.
我想从一个具有不同标签的特定应用程序中过滤日志,只是想知道是否有可能.
leaves exactly the package name field (after PID) empty.
I want to filter the Logs from a specific application with different Tags, just wondering if it is possible.
推荐答案
logcat
记录没有程序包名称字段".因此,没有标准/内置的方法可以对其进行过滤.
logcat
record does not have a "package name field". Therefore there is no standard/built-in way to filter by it.
尽管自Android 7.0起,您可以结合使用logcat --pid
选项和pidof -s
命令来按二进制/程序包名称过滤输出:
Although since Android 7.0 you can use logcat --pid
option combined with pidof -s
command to filter output by binary/package name:
adb shell "logcat --pid=$(pidof -s <package_name>)"
在Linux/MacOS上将"
替换为'
Replace "
with '
for Linux/MacOS
这篇关于带有包名称的adb shell Logcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!