10

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?

0

7 Answers 7

18

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:

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).

3
  • 1
    Starting from Android 4.1 you need root access to read other apps logs. CatLog developer posted explanation. Assume these apps works for < 4.1 versions
    – mente
    Jul 5, 2013 at 7:16
  • 1
    This shortcut doesn't work on mine Android 4.1.2
    – mente
    Jul 5, 2013 at 12:13
  • I created a utility to collect logs from a PC: gist.github.com/hrj/5983971
    – HRJ
    Jul 16, 2013 at 18:29
5

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

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
  • i want to do this from the phone, not from a remote machine with the SDK
    – Wulfbane
    Sep 14, 2010 at 13:34
1

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
  • yeah, on Gingerbread... but today's Android does require root.
    – NH.
    Mar 13, 2019 at 23:46
1

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

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.

2
  • Have you got a link to that app, I can't find it in the Market?
    – GAThrawn
    Mar 22, 2011 at 16:59
  • @GAThrawn In case you're still interested: homepage and Google Play Store links.
    – Zuul
    Jul 29, 2012 at 6:23
0

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...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .