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

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

问题描述

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

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

logcat -v 长

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天全站免登陆