08 May, 2012

How to: Getting android logs on the go


There's easy way for getting logs on a rooted android device
without fiddling with adb.

First of all should install Scripting Layer for Android (SL4A)
In the next step should to check that shell interpreter installed (menu -> view -> interpreters).
- If it was not, it should to add it (menu -> add -> Shell)
Finally should create a script.

I wrote the following script for get logcat.log, logcat_radio.log, dmesg.log, kmsg.log and last_kmsg.log

cd /sdcard/debug_info; LDIR=`date +%F_%H-%M-%S`; mkdir $LDIR; cd $LDIR;
dmesg > dmesg.log
su -c "cat /proc/last_kmsg > last_kmsg.log"
logcat -d -v time -b radio > logcat_radio.log
logcat -d -v time > logcat.log
su -c "cat /proc/kmsg > kmsg.log & sleep 1; kill %1"

this script makes a new folder in /sdcard/debug_info (debug_info directory should be created before using the script) and puts all the logs there.

If you need to collect data during long time, try next:

cd /sdcard/debug_info; LDIR=`date +%F_%H-%M-%S`; mkdir $LDIR; cd $LDIR;
logcat -v time > logcat.log

or

cd /sdcard/debug_info; LDIR=`date +%F_%H-%M-%S`; mkdir $LDIR; cd $LDIR;
logcat -v time -b radio > logcat_radio.log

In this case log will be collected until you stop the script.

Also you can run two or more script simultaneously.
For example one for collecting  logcat.log and another for logcat_radio.log or dmesg.log

1 comment:

  1. Best Casino Sites Online – Best Online Casino site in the UK
    Top UK Online Casinos in 2021 · Top Casino Sites luckyclub.live · 1. BetVictor · 2. InterTops · 3. LeoVegas · 4. Casumo · 5.

    ReplyDelete