[Atrix 4G Android Development] sendust7:
Boot-Time Auto-Superlog! [12 Apr 2013]

USERS --- TESTERS --- DEVS​

Plumb the depths of Middle Droid with Auto-Superlog!​

So…

Your device doesn't finish booting

It reboots on its own (and you may not know it)

An application or feature crashes (and you may not know it)

Generally speaking, any manually-launched app or tool could miss key events leading to random reboot or application crash.

Problem addressed with Auto-Superlog!​

cm10-auto-superlog-v1.0.zip (3MB): http://www.mediafire.com/?cf5f9rq4z7p6gep

This flashable zip is tested working on my Atrix running CWM Recovery 5.0.2.0 and CM10 SuperLite. It should also work on epinter’s CM10 4.1.x builds and on close relatives. Not sure about 4.2.x yet.

In this exciting age of alpha-beta ROM testing, my lightweight Auto-Superlog, presently built on epinter’s versatile CM10 boot image (for demo purposes), can help just about anyone, whether end-user, tester or developer!

In fact it is already helping me track down abnormal battery drain and shutdown problems! :D

Alternatively instead of flashing the boot-time version, you can extract “auto-superlog.sh” from the flashable zip and manually execute it at run time.

Features

Automatically launches at boot-time under “class_start core” --- just after ROM filesystems are mounted, thus maximizing the likelihood of capturing key events, even if phone does not finish booting

Comprehensive log set includes: system build properties (getprop), kernel configuration file (from /proc/config.gz), kernel dmesg and system logcat --- all in sync, all in ASCII text format, and all stored in a single gzipped, time-stamped tar file on $EXTERNAL_STORAGE/auto-superlog for easy access and analysis.

Android events are quietly, nimbly and continuously streamed via kernel “dmesg” and system “logcat” commands. The dmesg log is pushed at 2-second intervals (default) with a 1MB ring buffer which is cleared on each pass. Logcat is configured to log “main” and “system” events with a generous 10MB buffer to help in discerning error trends.

Access real-time dmesg and logcat output right on your device by tapping the /data/auto-superlog directory using a (root) file explorer.

Log file contents are time stamped using absolute time ([YYYY-]MM-DD HH:MM:SS), enabling users to correlate Android events with the outside world

Filename timestamps show when your system was rebooted

Self-cleaning feature: On reboot, your most recent superlog is gzipped and archived to $EXTERNAL_STORAGE and then is removed from /data/auto-superlog so only your most recent superlog remains on the /data partition.

Shell script: auto-superlog.sh is stored under /system/bin, enabling users to extract and execute it at run-time and/or customize.

How to kill dmesg and logcat? Use the ps and grep commands: http://stackoverflow.com/questions/3117095/stopping-an-android-app-from-console (It’s a sheepish way of saying “mechanization of this feature is still in work” lol)

Instructions

Nandroid Backup current ROM (security blanket)

Flash zip if running epinter CM10 4.1.x or close relative (e.g. SuperLite)

Reboot and relax.

…OR, if you don’t want to flash the zip, but still want the run-time features of auto-superlog, simply extract /system/bin/auto-superlog.sh from zip and do this…

After launching the script, just tap the Home button to resume other activity as the loggers are now running in background. Then you will have real-time streaming dmesg and logcat (as well as getprop and kernel config) at your fingertips --- literally.

The advantage of flashing the zip (if it’s compatible with your ROM) is that you are more likely to capture key events leading to a failed boot, random reboot or application crash.

Screenshots

​

Boot Image Source Code

This is the only change I made to CM10 boot.img...

ramdisk/init.olympus.rc ...

# sendust7 (12 Apr 2013)
service auto-superlog /system/bin/sh /system/bin/auto-superlog.sh
class core
# class main
# class late_start
user root
group system
# disabled
oneshot
# sendust7 (12 Apr 2013)

Documentation

dmesg: http://unixhelp.ed.ac.uk/CGI/man-cgi?dmesg+8

logcat: http://developer.android.com/tools/debugging/debugging-log.html#outputFormat

Android Encryption: http://source.android.com/tech/encryption/android_crypto_implementation.html

Thoughts and Ideas: This has been a fun project so far. Time permitting, I may be able to service bug fixes and add more goodies like event filtering.

Disclaimer: Standard disclaimers apply.

Credits:Emerson Pinter (CM10 for Atrix 4g), Cyanogenmod Team