ADB Shell is not displaying logs continously - android

I am trying to debug a Yocto project. I have flashed cpp binaries on some device.
Now I my trying to display logs using below adb command
adb shell tail -f /var/log/acs_main.log
The problem i'm facing is that logs are not displayed continuously.I have to cancel and again start to print further log statements.
Anyone can help me in this ?

Related

Android log file has missing lines

i use some batch script for android device , it should clear The device log , start and close an apk and then take the log out of it.
thats my code i use:
adb -s %DeviceId% logcat -c
adb -s %DeviceId% shell am start -n com.mv4d.sdktutorialbasicchangeframesize/com.mv4d.sdktutorialbasicchangeframesize.MainActivity
SLEEP 80
adb -s %DeviceId% shell am force-stop com.mv4d.sdktutorialbasicchangeframesize
adb -s %DeviceId% logcat -d -v time > D:\Roey\Jen2\ChangeFrameSize\Results\Logcat\AndroidLog.txt
the created log is missing lot of first and last lines. (that appears if you start the app and check the live log via android studio for example...) any ideas ?
adb logcat -d [file] will only dump the logs currently in memory, not all logs since the device boot.
The logs stored by LogCat are circular, which means that when the allocated space for logs starts to run out, LogCat with delete older logs to make space for newer logs. That means you can only have a certain number log lines in memory at any given time (usually set to something like 16kb).
To be able to get all logs you will have to make LogCat write logs out to a specific file, instead of just keeping them in memory.
You can do this with the following command:adb logcat -f [file].
This will make LogCat write out any log in memory and any future log to the specified file.
NOTE: The specified file must be on the device itself and can be pulled from the device.(adb pull [device file] [destination file])

nohangup using ADB shell

I am trying to do a logcat to a file using adb shell by following command -
adb shell "nohup logcat -f /storage/sdcard0/myLog.txt -v time &"
If I do a ps | grep logcat, I don't see the logcat command. Even I tried to see nohup command, but it is not there. So somehow above command does not work.
However if I perform the command in 2 steps it works fine -
adb shell
nohup logcat -f /storage/sdcard0/myLog.txt -v time &
I can see the process using ps and logcat continues to record to the file even if I disconnect adb shell. Now I would like the first command to work, since I am using python scripts to issue commands via ADB. It is possible to change the python scripts, however I would like to know if I am doing anything wrong in issuing the first command and if it is possible to make it work.
try
adb logcat
not
adb shell logcat

How to run a shell script in android app?

I have one shell script placed in /sdcard/test.sh
And the test.sh file has the below command.
screenrecord --time-limit 10 /sdcard/sreee.mp4
When I run this command from adb shell command from Windows machine command executed successfully without any errors.
My Question is how can I execute the same script from Android app where When I press the start button?
Could you please help me out on this with a best example?

adb "error device not found" when trying to use 'adb shell' but "adb devices" detects the device

Guys basically I've plugged in a bunch of Android devices to a computer and each of them has adb enabled. I'm running a shell script to push certain files to the devices using the Device Serial Numbers stored in a text file. When I trigger the script the first time it works. if i trigger it again adb throws an error , "error device not found" though the devices are still detected using adb. If i close the terminal and reopen it and run the script it works fine. I plan to eventually automate the script running. How can i stop this from happening.
EDIT: This is the piece of code where the adb shell commands are triggered
cat device_serial | while read line
do
adb -s $line shell
cd /data/
ls
exit
adb -s $line root
adb -s $line push 'stestfile.txt ' /data/
echo "done"
done
I need to look at the script to fix the issue.
But looks like the problem is that the next time you run the script, you are actually in the device's shell instead of your computer's.

adb pull freezes when it encounters kmsg

I'm trying to debug why my android mobile will not boot. When I run:
adb pull / e:\temp
It freezes at
pull: /proc/kmsg -> e:\temp/proc/kmsg
Is there some way to stop it freezing here or to get 'pull' to by-pass this file.
(I'm running this command while the phone is sitting in the recovery menu as I cant get adb to run in any other state).
Samsung Galaxy GT-i5500, android 2.2, windows 7.
You can instead dump the log using
adb logcat -d > log.txt
This will provide you with the log which you can use to debug the issue.
Run-time messages can be obtained through
adb shell dmesg
For kmsg, the following command can be tried.
adb shell cat /proc/kmesg

Categories

Resources