How to redirect logcat output?

android, logcat

Solution

The easiest way I found is to use `System.setErr`. I allows you to easily redirect the error output to a file.

Example:

System.setErr(new PrintStream(new File("<file_path>"))

Problem

Is there a way to redirect the logcat's output towards an InputStream or something like that? I'm thinking of something in the lines of how you can redirect the stderr in C. I want to do it so its redirected when my app starts and everything that happends get dumped to a file.

Original source

Related problems