简体   繁体   English

从android / linux中的特定PID获取所有日志?

[英]Get all logs from specific PID in android/linux?

see currently in android there is one utility called logcat which shows all user space programs's log on stdout or terminal. 请参阅当前在android中有一个名为logcat的实用程序,它可以显示所有用户空间程序在stdout或终端上的日志。

but here I do not want all messages in list. 但是在这里我不希望所有消息都在列表中。 But i want to see only specific application's log only. 但是我只想查看特定应用程序的日志。

So if i need to make such utility then how can i do that? 所以,如果我需要使用这种工具,那我该怎么做呢?

see if i want all log from pid 132 and 324 then i will run as follows on terminal 看看我是否要从pid 132和324获取所有日志,然后在终端上按以下方式运行

logcat_special 132 324  

and now it will show all messgaes from that pid. 现在它将显示该pid中的所有消息。

If this things are hard to implemet with pid then we can go with application name as 如果使用pid很难实现这一点,那么我们可以使用应用程序名称作为

logcat_special vlc  

Log cat already has a package based filter . Log cat已经具有基于包的筛选器。 take a look here : Logcat options also according to this answer you can find app package from its pid. 在这里看看: Logcat选项也根据答案,您可以从其pid中找到应用程序包。

So combining that with logcat you can achieve the functionality you are after. 因此,将其与logcat结合使用即可实现您所追求的功能。

This option should work: 此选项应该起作用:

logcat <your package name>:<log level>

for example logcat android.test:V 例如logcat android.test:V

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

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