带有包名称的adb shell Logcat [英] adb shell Logcat with Package Name

查看:582
本文介绍了带有包名称的adb shell Logcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否还可以在每行中显示日志的包名称?
使用

Is it possible to also display the Log's Package Name in each line?
Using

logcat -v long

logcat -v long

将包名字段(在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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆