Search code examples
androidshelllogcat

Terminate Logcat's -f output via shell on Android device


I am currently running logcat -v time -f /dir/to/file.log on an embedded Android device. Everything is running successfully and the log is piped to the file file.log.

However, I am unable to terminate logcat's piped output to the file. I am aware of CTRL C, but I am looking for a String based command that can be interpreted via Android's Runtime.getRuntime().exec() method.

My aim is to terminate the stream of data written to file.log. No other condition applies.


Solution

  • Did you consider looking at Process's documentation? I would figure destroy() should work for you.

    ref

    https://developer.android.com/reference/java/lang/Process.html