I have a wall hung tablet that I developed a for personal use application for. Since its wall hung, getting some logs out of my app is a bit of a pain.
I opted to go for running logcat -f
in my foreground service and saving the logs to the tablet where I can pull them at a later time.
I am executing it using a simple logcatSaver = Runtime.getRuntime().exec("logcat -f " + logFile);
.
What tends to happen is after a few minutes, the log stops saving. I added some logging points before / after the execution as well as generally in my foreground service and it doesn't look like its related to the foreground service it self. It goes up, stays up, like it should. I'll add that my application as well as the foreground related bits are all working just fine. So no hard crashes are involved.
I'm leaning towards thinking its logcat -f
aborting for some reason.
Any ideas as to why logcat -f
would fairly quickly out of nowhere abort saving to my destination?
From what I have briefly read this is firmware related. I am experiencing this on an Amazon tablet, so who knows what kind of naughtiness they are doing.
I am fairly new to android development but for the time being I have resolved this by launching the logcat -f
process in its own thread, and instead of dumping straight to a file via -f
I am reading the output from stdout and saving it to a file on the android end. If logcat terminates, I just relaunch and keep appending to the log file.
Not ideal, but its works.