[Kindle Fire Android Development] soupmagnet:
Okay,

This is a super simple script that continually saves the output of 'logcat' to file so there will be a record of what happened on your device in case you are forced to reboot. It's possible this will lead to identifying the cause of some SODs.

Requirements:

* Android Terminal Emulator (or equivalent app)

* Root privileges

* bglager.zip

Instructions:

* Download and unzip bglager.zip to your data directory

* Launch the Terminal Emulator and enter the following commands:

cd data
su
sh lager

Afterwards, just press the 'home' or 'back' key and go on about your business.

What you need to know:

* Most, if not all terminal emulators will run in the background until you explicitly close or kill the app. There should be an icon in your notifications bar to indicate the emulator is running. As long as the emulator is running, the script will be running also.

* It will run in the background and you can use your device as you normally would, but it will be run in active memory. I'm not sure how much of your resources will be required to run it but I'm sure it won't be too noticeable...if at all.

* The script takes the output of logcat and saves a new file for every 1000 lines logged. Each file saved averages between 80 and 100 kB in size. The number of files saved in an hour will vary depending on usage. Keep an eye on your /data folder to get an idea of how much space will be required to run over a period of time and to make sure it doesn't eat up all of your internal storage. This shouldn't be too much of a problem and you can easily go several hours (probably overnight) without worrying about it. The files will be saved in '/data/cat-logs', so if needed, delete the oldest ones to make more room. Again, this shouldn't be much of a problem...just don't forget that it's there. I'll be working on a way to zip the files and shrink them down to around 5 - 10 KB each, but this will work for now.

* The script will still work while the device is asleep, but rebooting will definitely kill it. If you reboot or for some strange reason get a terminal emulator FC, start up the terminal and run the script again.

* Don't post your logfiles in the forums. They may contain sensitive information that you wouldn't want to get into the wrong hands. Take the last one or two logfiles saved (or more, depending on the Developer's needs) and send a PM or email to the respective Developer, if requested. No spamming, please.

I don't suggest anyone use this script just for the hell of it. It's intended for people with SOD or similar issues that would prevent logcat to be run normally. Hopefully this will be a useful tool in helping the Developers get to the root some major problems.

Developers:

Obviously this is a simple script and the same idea could probably be implemented for kmsg, cpu stats, or any other rolling logs or messages. Let me know if you think anything like this would be helpful and I'll see if I can work something out. Plus it will give me a chance to learn more about Android and shell scripting.

Update: 12.13.2012

I've updated the script to compress each file that hasn't already been compressed, once every hour. If you're running the original release of this script, shut down the terminal running the script, replace it with the new one and run it as before. With compression, one could easily go several days and lose no more than 20MB of storage. Without compressing the files, that number could easily be nine times that amount and your internal storage can be eaten up pretty quickly. Please update if you plan on running this script for any considerable length of time. (download link has been updated accordingly)

Download:

* bglager.zip