Whitelist my App in logcat / chatty identical 1 line - android

Logcat is filtering my logs, so I get only:
1234-1234/com.example.test I/chatty: uid=45678(com.example.test) identical 1 line
This is a serious issue for me, I tried applying the solutions suggested in other threads like
adb logcat -P ""
I also read the documentation (logcat --help and the "-P" option at official documentation like adb logcat -P 45678), but this also didn't help.
adb logcat -p shows that I whitelisted my app:
adb logcat -p
45678 (the UID of my app)
Still the logs are getting filtered. How can I fix that? I simply want no log filtering on my app during development.

My fault. I checked in Android Studio where I had the log leve filter set to "Info". The chatty message is "info" level, my log messages were "verbose" level. Actually I am getting both, my app log messages and the chatty messages...
Make sure to test without Android Studio using logcat: adb logcat and see if you see your log message. If that works, something is selected wrong in Android Studio like it was for me and by me.

Related

How to get logcat crashes

A newbie logcat question here, I am sure this is well known but could not find the answer. Sorry.
I want to use logcat for the users of my app MyApp to email me crash reports that obviously I don't know where they will appear. I want to print Warning and above only for my app.
I read the the documentation, and understood that, to print logcat only for a package I should do something like:
logcat -d -v time MyApp:W *:S
However that does not work: that is just for tags, not for app names.
I read people suggesting something like
logcat -d -v time *:W | grep MyApp
but that does not work either: the error messages, exactly what I am interested in, do not print MyApp name in all the lines.
I also tried
logcat -d -v time --pid=$(pidof -s MyApp) *:W
but that does not work either since the app crashed already, so it is not running, and it will send me the log of the still running MyApp PID.
What I ended up doing was to print only the last 20 minutes of everything with:
long timesinceepoch = System.currentTimeMillis()/1000 - 1200;
Process process = Runtime.getRuntime().exec("logcat -d -v time -t "+timesinceepoch+".0 *:W");
but I still get lots of trash and big files, of course.
So how do I add a MyApp tag to ALL the logcat logs of MyApp?
EDIT: Actually, in Android Studio the MyApp appears in the logcat, and there is an option to show logcat for a single app. Isn't Android Studio logcat and adb logcat the same??
This is totally unnecessary since when an app calls logcat it only logs the calling app logs. See this (thanks #jake-lee !).

Filter logs of given application in cmd not working

Note:
This question is a duplicate of Filter log messages by PID or application package in Android.
But there is no correct answer to that question & it is very very old.
I can't make any changes in the app codebase as suggested in the accepted answer, I can only access the app build.
As per Android Docs: https://developer.android.com/studio/command-line/logcat#alternativeBuffers
We should be able to filter logs of a given application using the command:
adb logcat --pid=<pid>
--pid= ... Only print logs from the given PID.
But I am getting an error "unrecognized option" when I enter it in cmd.
Got PID of application using:
adb shell ps <app-package-name>
Note: Want a solution without using cmd alone, not using Android Studio.
For adb --pid command to work , the device/emulator in which you have tired capturing the logcat messages should atleast be Android 7.0 . Otherwise this command will not work.
if you have device with android 7.0 above , then try this command
adb logcat --pid=19816 *:D
replace your pid value and * means (any tag) : D meas DEBUG severity log messages
if you have device which is older versions , you can search specific logcat messages based on your package name string or given tag strings like this
adb logcat | findstr <PACKAGENAME OR TAGS>

Where is the audit.log for Android 5?

On Android Kitkat, the SELinux audit log can be found here:
/data/misc/audit/audit.log
However, I cannot find this file on Android 5.0 (Nexus 5). Any idea where I can get the audit log?
Either kmsg or logcat; auditd was never officially merged (oem specific).
adb shell dmesg
or
adb logcat
Note that the logcat version is not formated in a way understandable by audit2allow but the dmesg output is.
The auditd code for Android (I am the author of) was never merged onto AOSP and thus mainline Android, it was rejected here:
https://android-review.googlesource.com/#/c/51651/
Some OEMs picked the change back from either there or here:
https://bitbucket.org/seandroid/system-core/commits/branch/seandroid-4.3
See commits:
11389
e2cfa
The current implementation that routes the logs into logcat is under Change-Id: I421bcf33e7e670d596628b1b5c7c25536ce2d3fe (I could not post more than 2 links, so google for Android-Review and copy the change id starting with the capital I into the Gerrit search box)
This worked for me.
dmesg | grep 'avc: '

How do I filter logcat messages in the terminal without a tag?

Android Studio's logcat is unusable; it goes in and out and rarely shows messages on restart, so I've started using adb logcat on my terminal. Reading http://developer.android.com/tools/debugging/debugging-log.html gives examples of filtering with a tag. What if I don't know the tag, but want to show all error with an error substring I know?
You can always simply pipe the logcat to grep:
$ adb logcat | grep 'known error substring'
If you are on Windows, then use find instead:
C:\> adb logcat | find 'known error substring'
You can try pidcat (by Jake Wharton).
It's a "colored logcat script which only shows log entries for a specific application package", as the author says.
If you're on windows, you can clic on left upper corner > Edit > Search and then introduce the substring you know.
Most probably the terminal for Linux has the same feature, but I don't know how to access to it.

Samsung Galaxy s2 DSR is ON. Don't sent DTR ON

When I plug my device to my computer I keep getting the following error in the LogCat:
07-12 15:23:57.695: E/DataRouter(1820): DSR is ON. Don't send DTR ON.
07-12 15:23:59.700: E/DataRouter(1820): usb connection is true
My OS is 4.0.3 GT-19100T.
I have seen posts about it but no answer. does any1 knows how to stop these annoying messages in my LogCat?
You can selectively disable logs from appearing. For example in your case, you can do
adb logcat DataRouter:S
If you want to completely disable logs
adb logcat -s
This and a lot of others errors is a bug of firmware (or preinstalled application). You cannot do anything.
If you use Linux I suggest to use grep to filter this messages
If you want to see just your app's log messages, use '-s' to filter out everything else and then specify your app's tag along with the lowest level of logging you want:
adb logcat -s MyApp:V # show only MyApp, all logging levels
adb logcat -s MyApp:I # show only MyApp, logging levels 'info' and above
To see the available filter letters, use
adb logcat --help
They are (in order of precedence):
F fatal
E error
W warning
I info
D debug
V verbose
They correspond to using Log.d(...), Log.i(...), etc., in your app.

Categories

Resources