I am using a Samsung Galaxy S3 device for development and my app is using the camera.
In the logcat, there is an output made by the native system with the tag Camera-JNI that is written to logcat like 20 times per second, causing the logcat to clean the oldest entries very fast.
Is it possible to disable logs from already installed apps or system logs to prevent this? Filters doesn't work, as the logcat is still filled and lines are still being clared.
Thank you.
EDIT
The documentation says this:
You can change the default level by setting a system property: setprop log.tag.<YOUR_LOG_TAG> <LEVEL>. You can also create a local.prop file that with the following in it:
log.tag.<YOUR_LOG_TAG>=<LEVEL> and place that in /data/local.prop.
EDIT 2
I already did this (rooting the device, pushing the local.prop file to /data and rebooting) but the tag is still appearing
I can see the following by examining the android source code (2.3.x):
Executing
shell setprop log.tag.XYZ
will not work here (frameworks/base/core/jni/android_hardware_Camera.cpp), as logging is being done using the LOGV() macro. This method of logging does not use properties to detect if some component wishes to disable logging. That is as far as I am able to trace the calls trough the android code.
So using setprop(...) will not work for disabling logging from an android system component but it should work when the logs come from user apps etc. written in Java which use base/core/java/android/util/Log.java and frameworks/base/core/jni/android_util_Log.cpp to log. My guess is that android_util_Log_isLoggable() is what is being used to filter.
IMHO I see no other alternative than building from source for your device and disabling the LOGV macros in the camera code you are using.
You can try something like adb shell setprop log.tag.Camera-JNI ERROR. If it doesn't work simply filter the log or dump it to a file and use grep to find the lines you are interested or filter out the camera with grep -v Camera-JNI.
If you want to see specific tags use:
logcat -s YourTag:* SecondTag:* ThirdTag:* ...
You can also use adb logcat
Just specify <TAG>:* as many times as you want to filter the tags you need.
Example: adb logcat -s AndroidRuntime:* MyApp:* filters AndroidRuntime and MyApp tags. So you see all uncaught exceptions (crashes) and also all logs of your application.
Related
In my app, I am using Timber as a logger. I am accessing the logs from the terminal via adb using this isntruction:
./adb logcat com.company.my_app:D
I do get the logs but the issue is that I am getting a crazy amount of noise from the OS (ie SurfaceFlinger , GraphicBuffer, vndksupport) which make the logs harder to read.
Is there a way to filter the logs like in Android Studio and just get logs from my app. Thank you !
P.S. I have trie a few answers from here but none of them remove the noise.
What works best for me is to grep for the process ID which is displayed in every log line. In the example below 7098 is printed with every log line.
08-10 18:48:39.825 7098 7144 D NetworkModule: --> END POST
So this is the adb instruction used to get filtered logs:
adb logcat | grep -F "7098"
Note: the process ID is not static and it is going to change if app is hard-closed or device is restarted.
I don't know if it is the best solution, but it works in my case.
I'm trying to figure out what is producing this debug output:
04-25 15:58:04.883 1542-5012/? D/NetworkStatsCollection: getHistory:mUID 10266 isVideoCallUID: false
The above output runs continuously with my phone plugged in. I don't see this using the emulator and I've uninstalled the app I'm working on, so I don't think it's that. I've tried restarting the phone, to no avail. How can I determine what app is causing this?
Use adb shell ps | fgrep 1511 to see what app is tied to the PID of 1511, which according to your LogCat output is the app that is doing the logging.
(BTW, in the future, please post LogCat output as text, not screenshots)
I got to know that we can get debug prints from particular module through adb using
adb logcat -s Unity ActivityManager
adb logcat -s Unity ActivityManager PackageManager
But if i issue the command like( Explicitly make the spell wrongly )
adb logcat -s Unity Activitymanager, something is going wrong
I just want to know is there any adb command to list the entire module name that we can use along adb logcat -S unity ****** to print module related info.
There is no adb command that gives a list of tags that you can filter the logcat output on, because there is no limitation at all on what a tag contains, except one of length. At the API level, each log call provides a tag to go with the log text - many apps will make the tag in some way related to the modulename that the code calling log resides in, but there is nothing that enforces this.
Apps can and do do unexpected things with the tag - for example using an incrementing counter as the tag, or using a timestamp! Perhaps more useful is the technique of passing a tag consisting of a fixed suffix followed by the hashcode of the object being logged.
There are two ways to obtain logs for android:
Use the logcat-view in DDMS prespective in eclipse. Pros - various
filters can be applied on the logs.
Print logs to a file using adb logcat command on console.
I was wondering if the logs obtained using both the methods are same?
If not, what is the difference (apart from filtering ease on ddms).
I mean, which logs should be used and when?
(I did not find both the ways giving the same logs)
I am interested in running
adb shell setprop log.tag.Volley VERBOSE
at all times so i can see always see these debug messages inside logcat. Is there somewhere I can perm specify this? I don't want to open a command prompt every time to set this.
to make my comment clear and visible as answer:
using leading word persist. prior to your package should lead to a persistent property.
adb shell setprop persist.your.package.name VERBOSE
sources: question in this post and Mike Lockwoods first answer in this thread
i don't know, if this works with AVDs that are restarted and if it's wiped together with the wipe user data of the avd.