3

I execute Logcat from a service in my app.

commandLine = "logcat -v time -b main"
process = Runtime.getRuntime().exec(commandLine);

When it runs on any AVD, it catches all log messages from any process running in the system.
When I run it in a real device (ASUS TF201) by copying the apk and installing the app in the normal way, it only catches log messages from my own applicaton.

The app runs fine, no crashes, all activities work fine, even the activity that starts and stops the logcat. The only difference between a run in AVD and a run in the device is the missing messages. I know there are missing messages because I run aLogCat besides my app and aLogCat does catch all messages.

What am I missing?

ilomambo
  • 8,290
  • 12
  • 57
  • 106

1 Answers1

1

This should always have been the intended behavior and is rightly fixed in Jelly Bean. Every application should only be able to access logcat information relevant to its own process.

In your case, you need to run the command as root to access logcat messages not belonging to your application.

-- References --

SO Question

Discussion

Android issue

aLogCat User comments

Hope this satisfies your curiosity.

Community
  • 1
  • 1
PravinCG
  • 7,688
  • 3
  • 30
  • 55
  • How do you explain that aLogCat does catch ALL messages? ::: It sounds not right, because logcat is used for debugging, and nobody can assure you that problems in your app are a consequence of your own app only ::: It makes much more sense that logcat shows everything to allow you to debug properly. With no need for rooting your device, that's silly. – ilomambo Mar 01 '13 at 19:49
  • @ilomambo Well you are entitled to your opinion however free access to logcat was a major security hole that gave a lot away unintentionally. – PravinCG Mar 01 '13 at 19:52
  • So if I get an "Out of memory" exception I can only look for the causes inside my own app? ::: Besides, your assertion is definitely not true, as I said, the app aLogCat, free for download, and open source, does catch ALL messages in Jelly Bean, you care to explain that? – ilomambo Mar 01 '13 at 20:11
  • It should not work on Jelly Bean unless you are rooted and have made the application as a system app. – PravinCG Mar 01 '13 at 20:15
  • Boy, this is a Kafka thread :::: I do appreciate your efforts to help me, I really do. But you are plainly wrong, it is not just my opinion. It is the fact that I have an app installed on my ASUS TF201, runing on Jelly Bean, called aLogCat, that shows ALL messages from all processes, it is just a fact I am not making it up. – ilomambo Mar 01 '13 at 20:36
  • I also have the aLogCat sources, but so far I could not understand what is it doing that I am not, in my app. – ilomambo Mar 01 '13 at 20:37
  • I also searched for the issue in the net. And I don't know why, but aLogCat v2.6.1 works on my ASUS Prime with Jelly Bean. It get logs from every other app. And my device is not rooted. I sent an email to Jeffrey Blattman, the aLogCat developer to see if he can clarify the reason why it works, when it shouldn't, according to the othe stuff you dug up. I'll post the answer, when/if he responds. – ilomambo Mar 03 '13 at 18:12