访问logcat是否需要root? -- root-access 领域 和 logging 领域 和 terminal 领域 android 相关 的问题

Does access to logcat need root?


简体版||繁體版
9
vote

问题

中文

我的设备已经植根了,这就是我要问的原因。

您是否需要root来监视手机上的logcat流?如果我从手机上的终端内运行logcat命令,那会工作吗?

english

My device is already rooted, this is why I'm asking.

Do you need root to monitor the logcat stream on the phone? If I ran the logcat command from within a Terminal on the phone, would that work?

        

回答列表

16
 
vote

市场在市场中的免费应用程序声称能够显示您的Logcat,并不提到root。应该只带你几分钟试试他们:

  • catlog
  • Alogcat
  • logViewer

编辑:感谢@mente提醒我,这些应用程序只能让您在旧版本的Android中查看完整的日志文件。 Android 4.1在Logfiles周围带来了一个新的安全模型,这意味着应用程序只能读取自己的日志文件和日志文件,并且无法读取系统或其他应用程序编写的日志文件条目。

但是,App的用户仍然有一种方法,以生成应用程序最近的日志条目的日志文件,以便发送给开发人员,并且用于手机的所有者来授予权限以允许应用程序在没有完整root的情况下读取日志文件,但这确实要求您使用adb命令,不幸的是将其超出大多数普通手机用户的范围:

如果您希望用户给您调试信息,则可以使用 它们生成带有电源+卷下来的错误报告+卷 包括日志和大量的其他数据,并自动提出 他们的电子邮件应用程序发送它全部(加上屏幕截图)。我们只是 讨论我们应该有一种更简单的方式来产生这些 好吧,我会看看为设置应用程序添加一些东西。

我也已经开始介绍"发展" 的概念 权限,读取日志被归类为。这允许应用程序 请求权限,但在安装时没有得到它。然而,你可以 使用adb shell命令授予它,一旦安装了adb shell命令。在某些人 点以后我希望在系统中拥有一个UI来做这一点,但我们 要抓住它,要小心我们如何呈现这个。

摘录来自a post在google groups上帖子由Dianne Hackborn,Android框架工程师。我的重点。

提到的adb命令授权读取日志的应用程序权限是:

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

此设置应生存重新启动和升级应用程序(但不会卸载/重新安装)。

 

These free apps in the Market claim to be able to display your logcat, and don't make any mention of root. Should only take you a few minutes to try them out:

  • CatLog
  • aLogcat
  • LogViewer

EDIT: Thanks to @mente for reminding me that these apps will only let you view the full logfile in older versions of Android. Android 4.1 brought in a new security model around logfiles that meant that apps could only read their own logfiles and logfile entries, and can't read logfile entries written by the system or other apps.

There is however still both a way for an app's user to generate a logfile of the app's recent log entries to be sent to a developer, and for a phone's owner to grant permissions to allow an app to read the logfile without full root, but this does require you to use an ADB command, which unfortunately takes it out of the reach of most normal phone users:

If you want the user to give you debugging information, you can have them generate a bug report with power + volume down + volume up which includes the logs and lots of other data, and automatically brings up their e-mail app to sent it all (plus a screenshot). We were just discussing that we should have an easier way to generate these as well, I am going to look at adding something to the settings app.

I also have started introducing the concept of a "development" permission, which read logs is classified as. This allows the app to request the permission, but not get it at install. You can however grant it with an adb shell command once it is installed. At some point later I expect to have a UI in the system for doing this, but we are going to hold off on that to be careful about how we present this.

Excerpt from a post on Google Groups by Dianne Hackborn, Android Framework Engineer. My emphasis.

The mentioned ADB command to grant an application permission to read the logs is:

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

This setting should survive reboots and upgrades of the app (but not uninstalls/reinstalls).

 
 
     
     
4
 
vote

您不需要root手机运行 adb logcat 与android sdk,但我确实在我的终端仿真器我确实必须是root(使用 su 命令 - 我的手机已经植根了)运行logcat在我的手机上的终端。

所以是:如果手机上有root,您可以从手机上的终端运行logcat。

 

You don't need to root your phone to run adb logcat with the Android SDK, but I did just test it in my Terminal Emulator and I did have to be root (used the su command -- my phone is already rooted) to run logcat in the terminal on my phone.

So yes: if you have root on your phone you can run logcat from a terminal on your phone.

 
 
1
 
vote

否,您不需要root来获取Logcat信息。

要做,您可能希望下载Android SDK并运行"adb logcat" ,使用SDK附带的adb工具。或者,您可以安装ADT Eclipse插件,并使用其方便的流式Logcat Viewer。
 

No, you don't need root to get logcat information.

To do it, you probably want to download the Android SDK and run "adb logcat", using the adb tool that comes with the SDK. Alternatively, you could install the ADT Eclipse plugin and use its handy streaming Logcat viewer.

 
 
 
 
1
 
vote

否,您不需要root访问logcat。我的设备(三星Galaxy Note,Gingerbread 2.3.6带股票ROM)没有植根(尚!),我使用以下方法访问我的设备上的日志:

  • catlog app
  • Alogcat App
  • 激活的sshdroid应用程序,并使用ssh客户端连接到设备终端
  • 使用Android SDK和运行 adb logcat
但是,终端应用程序不允许您运行Logcat,并为您提供"权限拒绝" 。我不确定为什么。
 

No, you don't need root to access logcat. My device (Samsung Galaxy Note, Gingerbread 2.3.6 with stock ROM) is not rooted (yet!) and I have used the following ways to access log on my device:

  • CatLog app
  • aLogcat app
  • Activated SSHDroid app, and connected to the device terminal using an SSH client
  • Using Android SDK and running adb logcat

However, the Terminal app doesn't allow you to run logcat, and gives you "permission denied". I'm not sure why.

 
 
 
 
1
 
vote

似乎您无法从终端仿真器运行logcat,而不在手机上扎根。在这种情况下,你必须先苏。它来自Android权限:终端仿真器根本没有足够的权限来查看设备的日志。所以系统表示许可否认。

另一方面,随着其他人所说,有很多应用程序允许您查看设备的日志,因为它们请求权限。
 

It seems you cannot run logcat from Terminal Emulator without having root on your phone. In this case you have to su first. AFAIK, it comes from Android Permissions: Terminal Emulator simply doesn't have enough permissions to view device's log. So the system says Permission denied.

On the other hand, as others said, there are plenty of apps that allow you to view device's log just because they request the permission.

 
 
0
 
vote

应用程序有能力将日志信息输出到屏幕,据我所知是与logcat吐出的相同日志信息。

 

The application Android System Info has the ability to output log info to the screen which as far as I can tell is the same log info as logcat spits out.

 
 
   
   
0
 
vote

logcat不需要root。 SIMPLES - 与不同的Android版本相对于不同的Android版本,它是跨电路板的一个事实上的标准,而且是无论您扎根于root,还是诊断问题的标准手段 - 您安装了一个应用程序, App Force Close,您向开发人员抱怨所谓的应用程序,机会相当高,开发人员会要求"发送在Logcat" ,无论您是否植根,就要源于!

Alogcat 是一种方式收集信息,以选项记录到网页布局或纯文本,请记住,如果您安排以每15分钟的特定频率登录,则SDCard将快速填充。

另一个方面,Logcat的用法将根据它可以存储的范围依赖于内核 - 在ROM使用的任何内核中,从内核级别记录的源,在其中保留内存可以使用适当的定义在 drivers/staging/android/logger.c 中找到logcat服务,例如:

define_logger_device(log_main,logger_log_main,64 * 1024) define_logger_device(log_events,logger_log_events,256 * 1024) define_logger_device(log_radio,logger_log_radio,64 * 1024) define_logger_device(log_system,logger_log_system,64 * 1024)

再次,里程会有所不同,这些ROM的一些开发人员将选择最小化消耗以减少内存开销...

 

Logcat does not need root. Simples - its a de-facto standard across the board in respect to different Android versions and is part of Android irrespective if you're rooted or not, and is a standard means for diagnosing problems as in for example - you install an app, the app force close, you complain to developer of said app, chances are quite high the developer will ask "send over the logcat" regardless if you're rooted or not!

aLogCat is one way of gathering the information, with the option of logging to webpage layout or plain text, bear in mind, if you schedule it to log at a certain frequency such as every 15 minutes, the SDCard will fill up quite quickly.

Another aspect, usage of logcat will be dependent on the kernel in terms of how much it can store - in any kernel that is used by the ROM, the source for the logging from a kernel level, where it reserves the memory for the logcat service can be found in drivers/staging/android/logger.c using the appropriate defines for example:

DEFINE_LOGGER_DEVICE(log_main, LOGGER_LOG_MAIN, 64*1024) DEFINE_LOGGER_DEVICE(log_events, LOGGER_LOG_EVENTS, 256*1024) DEFINE_LOGGER_DEVICE(log_radio, LOGGER_LOG_RADIO, 64*1024) DEFINE_LOGGER_DEVICE(log_system, LOGGER_LOG_SYSTEM, 64*1024)

Again, mileage will vary, some developers of such ROMs will choose to minimize consumption to reduce memory overheads...

 
 

相关问题

3  如何为rooted设备安装其他终端命令的捆绑?  ( How to install bundles of additional terminal commands for rooted devices ) 
我最近扎根了HTC野火S设备并闪过Android 4.1.2 AOKP果冻豆类自定义ROM。一个好处是我现在可以使用终端。 我有点习惯于在台式机上使用终端仿真器,但从中从未在Android设备上做过。我注意到没有找到一些命令,例如: $ tree /system/bin/sh: tree: not found ...

8  从终端仿真器运行应用程序[已关闭]  ( Running applications from a terminal emulator ) 
关闭。这个问题是 off-topic 。它目前不接受答案。 想要改进这个问题?更新这个问题,所以它是关于android爱好者堆栈交换的主题。 关闭 ...

0  通过应用程序以编程方式设置分辨率,如何让设备记住新设置?  ( After programmatically setting the resolution through an app how can i make the ) 
所以我通过编辑系统文件来设置分辨率。这是对我有用的唯一方法。更常用,我发出此命令: echo 1080p60hz > sys/class/display/mode 到设备的术语。如果发布,这会成功将分辨率更改为1080p60Hz或不同的值。但是重新启动设备后,返回其先前的分辨率。 nayone知道如何...

1  关闭/杀死“Android终端仿真器”应用程序  ( Closing killing android terminal emulator app ) 
我有一个Sprint LG G3运行Android 4.4.2。我正在使用 Android终端仿真器通过jackpal。在关闭应用程序后重生。我看到终端进程和儿童壳,但这种方式似乎太手动了。 当我从顶部下拉列表中关闭唯一的窗口时,它暂时关闭,然后在"最近的应用程序" 列表中重新出现。有一种不可替换的通知,称"终端会话...

3  手动安装Split APK  ( Install split apk manually ) 
最近我必须知道一个名为split apks的东西,并发现切片作为无效的apk文件,只有基础是。不幸的是,这意味着通常的默认包安装程序无法处理此操作,因此我必须知道另一件名为SAI的东西,一个拆分APK安装程序,能够与或没有root工作。然而,好奇,我想知道它是如何在内部工作的,并开始做一些研究。我没有走得太远,但我必...

0  php与mysql从Android上的命令行支持  ( Php with mysql support from the command line on android ) 
是否有用于Android的终端仿真器,允许使用MySQL支持使用VI和PHP? PS。遗憾的是,Termux不允许将PHP连接到MySQL。 ...

9  访问logcat是否需要root?  ( Does access to logcat need root ) 
我的设备已经植根了,这就是我要问的原因。 您是否需要root来监视手机上的logcat流?如果我从手机上的终端内运行logcat命令,那会工作吗? ...

7  终端仿真器的SSH尝试读取/data/.ssh而不是$ home / .ssh  ( Terminal emulators ssh trying to read data ssh instead of home ssh ) 
当我尝试使用终端仿真器的ssh时,我得到 ssh:警告:创建/data/.ssh失败:权限被拒绝。 或自2012-08-19: 无法创建目录'/ data / ssh_client'。 但是当我键入:时 echo $HOME /sdcard 为什么不ssh检查 /sdcard/.ssh 或 /sd...

16  是否可以通过shell启用位置服务?  ( Is it possible to enable location services via shell ) 
是否可以通过adb或终端仿真器启用位置服务(GPS或Google NetworkLocation)? 我在扎根的手机上。 额外点:也可以更改其他与系统相关的设置? ...

13  真实终端(根或根部)  ( A real terminal root or no root ) 
我在我的笔记本电脑上使用Kubuntu,但这适用于任何Linux发行版。我可以打开一个终端窗口,然后键入 sudo apt-get update , sudo apt-get install packagename. 有一个终端可以在android上执行命令吗?它不一定是"sudo" ,我只是意味着履行命令。我使用G...




© 2022 it.wenda123.org All Rights Reserved. 问答之家 版权所有