Question

I've redirected the logcat to file in my code when my app starts. But when my application is restarted, the redirecting code runs again and the result is that each line in the log is written twice.

How can I execute the command and make sure the child process dies when the parent dies?

String.format("logcat -f %s -r %d", filename.getAbsolutePath(), LOG_FILE_SIZE_KB);    
Runtime.getRuntime().exec(cmd);

How can i make sure that my app's logcat is redirected only once? (Whats happends if other app calls the logcat and redirects it to it's own file, will the check still work then?)

thanks!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top