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.
Tap the ellipses, and select “send” to email the log as an attached text file along with general device information. That's it! Your Logcat has been successfully captured and sent to Professor Oak.
adb logcat –d > filename.txt This command will extract the logcat information from the connected device and redirects the output to a file on the PC. The option –d will take care that the output will stop when all output is flushed.
The Log class Log is a logging class that you can utilize in your code to print out messages to the LogCat. Common logging methods include: v(String, String) (verbose) d(String, String) (debug)
If you can connect the device for debugging, you can this from the command line
$ adb logcat > textfile.txt
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>"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With