Reputation: 195
I am running a script on an Android device and getting data from logcat. Is there anyway I can add debug statements to logcat in runtime using adb commands or any other means?
Upvotes: 2
Views: 805
Reputation: 6160
By default Android should redirect stdout and stderr to /dev/null. You can for instance change this behaviour by redirect stdout/stderr to log with:
$ adb shell stop
$ adb shell setprop log.redirect-stdio true
$ adb shell start
more info here: https://developer.android.com/studio/command-line/logcat.html#viewingStd
Update: From within your script, just use:
log -p i "your message"
to append the message to the log
Upvotes: 2