阅读从Android的所有应用程序日志,从内部为Android的应用程序4.2+ [英] Read logs from all apps on android from within an app for android 4.2+

查看:195
本文介绍了阅读从Android的所有应用程序日志,从内部为Android的应用程序4.2+的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信已经有改变方式的应用程序可以后的And​​r​​oid 4.2读取日志。但我想知道我是否可以从Android版的当前版本的应用程序读取所有包括logcat的系统日志日志?如果是的话它需要一定的权限,或不?

I believe there have been changes to the ways apps can read logs in android post 4.2. But I wanted to know if I can read all the logs including system logs from logcat from within an app for current versions of android? If yes does it need some permission or not?

推荐答案

除非你根植你不能因为果冻豆做到这一点。看到这个 Android的bug报告这的related讨论。报价:

Unless you rooted you cannot do this since Jelly Bean. See this Android bug report and this related discussion. Quote:

的变化是,第三方应用程序再也不能读   日志的权限,但是每一个应用程序只能读取包含日志   该行的 <他们/ em>的写了,无需任何许可。

The change is that third party applications can no longer get the read logs permission, however every app can read the logs containing only the lines they have written, without needing any permission.

请在访问日志从来没有SDK的一部分头脑,   而仍不是SDK的一部分。如果依靠它,然后,连   此更改后,运行打破了未来的风险。 (和   这是为什么这个迷路的文档,它不是一部分   该SDK,所以不是一个真正的地方记录吧,其实   慈祥的记录它会让它我们不SDK的一部分   想。 :P)

Keep in mind that access to the logs has never been part of the SDK, and is still not part of the SDK. If you are relying on it then, even after this change, you run the risk of breaking in the future. (And that is partly why this got lost for documentation, it is not part of the SDK, so there isn't really a place to document it, in fact documenting it would kind-of make it a part of the SDK which we don't want. :p)

此外,我们真的很希望,开发商不以此为证   进一步滥用系统日志,同时喷出越来越多的东西   把它从他们的应用程序。登录噪音一直是一个持续的问题   机器人(不只是为第三方应用,我们总是努力出货   开源的平台,而无需大量的噪音),如果事情继续   继续恶化,我们可能会做更多的修改它,更好地   控制它。

Also we really really hope that developers don't take this as license to further abuse the system logs and spew increasing amounts of stuff into it from their app. Log noise has been a continual problem on Android (not just for third party apps, we always struggle to ship the open source platform without a lot of noise), and if things continue to get worse we will probably make further changes to it to better control it.

编辑::如果你有接入设备,那么你可以登录偷看出现,甚至尝试格兰特说允​​许你的应用程序:

if you got access to the device, then you can peek logs there or even try to grant said permission to your app:

adb shell pm grant <pkg> android.permission.READ_LOGS

但对于其他情况下,你的运气了(除非你发现在该框架中的错误)

but for other cases you are out of luck (unless you find a bug in the framework)

这篇关于阅读从Android的所有应用程序日志,从内部为Android的应用程序4.2+的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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