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.
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 can see there are 4877 messages in total in my logcat but when I select the "All messages" filter, nothing is there.
I have tried the following:
adb kill-server
adb start-server
Of course, I went to DDMS and select my 1 and only device (a real handset, not an emulator) but it didn't solve the problem.
I can certainly view logcat messages using adb logcat command but it's very difficult to see compared to logcat in ADT.
Restarting ADT does solve this problem but it's happening way too often and you all know restarting ADT takes time.
Note that the "All messages (no filters)" filter is only an example here. The same issue happens to the custom filters I've created as well.
It doesn't always update that value when you clear it or if they get pushed out of the buffer. As long as you don't tamper with ADB or manually clear it it the 'No Filter' option should stay full though.
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.
Sometime just after I launched a new emulator, for very first time I was trying to upload my apk, however I got "emulator: ERROR: the user data image is used by another emulator. aborting".
I launched a new emulator, and left it alone, several minutes later, DDMS showed "device offline".
I had to restart a new one, you know, minutes wasted.
It's really bothering that I keep getting this error and slowed down debugging.
How do I fix it?
If the emulator is still alive, you can tell adb to connect to it via tcp (which is I believe what it does anyway, only it normally uses an 'emulator' class of name and would now get a ip:port one)
It's been a while since I've had to do that, but I think that if you were using emulator-5554 you would connect to your development machine's loopback one port higher, ie:
adb connect localhost:5555
If it works adb devices will show it an eclipse should see it as a deployment option
The 'in use' problem sounds like a stale lockfile perhaps left behind in a crash
I have another solution. try this
Run configurations > Target > Wipe user data > Run
In my case it happens when I have another process listening on emulator port.
e.g. if I see:
emulator-5554 offline
it means that something is using port 5554
Manually delete these following folders:
C:\Users\%UserName%.android\avd\AVD2.1.avd\cache.img.lock
C:\Users\%UserName%.android\avd\AVD2.1.avd\userdata-qemu.img.lock
this always works for me. :3
On Arch Linux x64, I had this similar problem which led me to this question. Using Eclipse, the emulator-5554 window would freeze, and Eclipse prompted me to start a new one. In the following dialog, emulator-5554 was reported to be offline, with an unknown target. If I started a new instance, it would be emulator-5556. This problem persisted through Eclipse restarts and log-off-on cycles too! Further, killx would close the window, but the process was still running.
So, find the emulator64-arm process id (not emulator-arm!):
ps ax | grep "emulator64-arm"
...and then just kill -9 it:
sudo kill -9 6728
...where 6728 was its PID. This completely disconnects the emulator so Eclipse can try to run it again.
Open android debug monitor window by
typing "monitor" command in cmd,
then select device in the monitor window,
click on down arrow as shown in the figure then just click on reset tab thats all you will get internet connection.
It was some strange
I had that problem, automatically stopped the emulator localhost:5554 after to launch the application.
I didn't know why it happens but intil today I did something different at I could launch as normality.
What I did as different was to change the prespective of Eclipse ADT. I was executing the application from Debug and now I executed from Java Prespective, it worked, I don't know the reason, I had to share it, sound some .. this answer but I resolved doing that without deleting and creating again my android virtual device.
Please guide me about this error
2011-05-02 18:37:20 - SimpleOptionMenu] The connection to adb is down, and a severe error has occured.
[2011-05-02 18:37:20 - SimpleOptionMenu] You must restart adb and Eclipse.
[2011-05-02 18:37:20 - SimpleOptionMenu] Please ensure that adb is correctly located at 'F:\android-sdk-windows\platform-tools\adb.exe' and can be executed.
It was working fine and now i am getting this error . I have restarted eclipse but nothing happed . Thanks
When I faced with this problem, resetting adb is usually the solution.
If this not solves, unplugging-replugging the device works. I never have had to restart Eclipse.
By the way, Reset adb option can be found in DDMS(Dalvik Debug Monitor Server)'s Devices tab.
I have had this error from time to time too, and restarting Eclipse has fixed it. My best guess is that you had the misfortune of getting the error twice in a row. Try restarting again and see if it goes away.
Writing this post has had the unfortunate effect of making me realize that the Android SDK bears a striking resemblance to Windows.
I do not know the reason but restating up my system worked for me :) !!!
I just posted the response below here:
adb kill-server not responding?.
I am duplicating it here too as Google considers this thread as one of
the top hits.
If zombie adb process is not the issue i.e. there's no adb.exe in the task-manager list, the problem is usually adb ports e.g. 5555, 5554, 5037 etc., being taken by other applications.
Solutions:
On all Windows: find the process taking one of those ports using netstat -bn and kill it from task-manager Ctrl+Shift+Esc is the shortcut.
On Windows 7 and 8: there's this new tool called Resource Monitor. It'll also allow you to find out the blocked port and blocking process under the network tab.
On Linux: the similar is done with netstat -pn. Feel free to use your grep foo as needed and kill the blocking process with kill or pkill.
Change Default ADB Port: Apparently default ADB port can be changed as described here by setting up an environmental variable before launching ADB. Give it shot. It'll allow more flexibility if you don't want to kill the blocking processes.