I have a created a windows batch file(log.bat) like this below :
adb logcat -c
adb logcat -d > log.txt
But it soon exits whenever I press log.bat command.
I want it to keep recording the logs unless I press ctrl+C.
I have a created a windows batch file(log.bat) like this below :
adb logcat -c
adb logcat -d > log.txt
But it soon exits whenever I press log.bat command.
I want it to keep recording the logs unless I press ctrl+C.
It looks problem is using option -d with logcat. Please check usage :
-d Dump the log and then exit (don't block)
Removing it will solve your problem.
From doc
-c : Clears (flushes) the entire log and exits.
-d : Dumps the log to the screen and exits.
So, in both cases, the execution stops once you run the logcat command with these options. Try this,
adb logcat -c && adb logcat > log.txt
This won't let the shell execution to be released once it executes logcat -c
and will start the next command right after it which is adb logcat > log.txt
that is going to write the logcat's log till you hit the Ctrl + c.
I need to create a batch file that can copy a log file to a PC. The batch file I created doesn't work. When I run all the commands manually it works however when putting into a script it hangs. Here are the individual commands:
Try this single line command:
$adb shell run-as com.example.name cat /data/data/com.example.name/files/logfile.log > c:\logs\logfile.log