How to redirect stdout to logcat from shell script to root device?

I run the shell script on the Android root device and I try to debug it by monitoring the stdout output generated by the shell script (either by commands or by echo). Can this be done by redirecting stdout to logcat?

+4
source share
2 answers

In the Android shell script use the following:

log -pv -t "test" "test script message" 

Then you will see a message in Androids Logcat:

adb logcat | grep test

Using:

 log [-p priorityChar] [-t tag] message priorityChar should be one of: v,d,i,w,e 

This works for me on Droid 4.4.3

+3
source

You can redirect stdio to logcat. This works for me, so the NDK C code printfs appears in logcat. Redirection method

0
source

Source: https://habr.com/ru/post/1488429/


All Articles