GET LOGS!

djsubterrain

Senior Member
Jan 4, 2012
3,544
3,392
253
Livingston
There are a lot of roms in these forums, a lot of devs also, if you experience an issue while using those roms then you will most likely post the details in those threads, in order for a dev to correctly diagnose the issue they really need to have logs from the phone to see what's going on.

I've uploaded a script that will do it for you:

Download script here

Just unpack the zip file and either double click the "getlogs.bat" file or open an elevated command window (hold down shift and right click inside the folder then click on in this Open command prompt window here) folder and run the same script.

It will output 4 logs as follows, they will have a datestamp on them as well to help devs track version issues :

Logcat
Radio Logcat
DMesg Log
KMsg Log

Those are the four that any dev should need for any issue. Once you get the logs output you should then be able to attach them to posts here.

If you've never used any sort of ADB commands with your phone you may get a popup on your phone asking for permission to do so, you need to accept this in order for the script to work, feel free to right click the batch file and edit it to see what it does.

Once the log files have been output to the dated folder they will then also be added to a dated zip file to assist in uploading to either XDA or attaching to Google+ posts to assist developers.

If you are experiencing an issue while performing some action, please try the action shortly before getting the log so the results are shown without the dev having to search too deep into the log.
 
Last edited:

djsubterrain

Senior Member
Jan 4, 2012
3,544
3,392
253
Livingston
I've also just compiled an exe version if you find it easier just to run a program:

https://www.androidfilehost.com/?fid=385035244224410927

It does exactly the same as the script version, just compacted into an exe format. If you don't trust it then feel free to continue using the batch file.

EDIT: Fixed it, now it'll spit out the logs and the zip file into a dated sub folder.
 

anupritaisno1

Senior Member
Apr 29, 2014
1,811
1,898
153
Adapted it to Linux

Also printf should replace echo. Idk about Windows but all new applications should start using printf and not echo
Code:
#printf
printf ANDROID LOG GRABBER
printf ===================
printf
printf Coded by DJSubterrain, adapted to linux by clannad
printf ---------------------
printf
printf Date grabbed
printf
printf
printf Detecting Devices, if you see a prompt on your phone please accept it...
printf
sudo adb wait-for-device
printf
printf
printf Making Log Folder
printf
mkdir log >> /dev/null 2>&1
rm -rvf ./log/*
printf
printf Getting Log...
printf
sudo adb logcat -v time -d > ./log/logcat-$(date +"%Y%m%d").txt
printf
printf Getting Radio Log...
printf
sudo adb logcat -b radio -v time -d > ./log/Radio-LogCat-$(date +"%Y%m%d").txt
printf
printf Getting DMESG Log...
printf
sudo adb shell su -c dmesg > ./log/DMesg-Log-$(date +"%Y%m%d").txt
printf
printf Getting Last KMSG Log...
printf
sudo adb shell su -c "cat /proc/last_kmsg" > ./log/Last_Kmsg-Log-$(date +"%Y%m%d").txt
printf
printf Zipping up resulting logs...
printf
printf
cd ./log/
zip -r logs-$(date +"%Y%m%d").zip *
mv *zip ../
printf
printf
printf Script complete, logs output and sent to dated logs folder
printf
printf Have a nice day and feel free to provide the dated log zip for your developer :D
printf
 

Attachments

  • Like
Reactions: djsubterrain

JMC1961

Senior Member
Jan 28, 2009
86
29
38
Cascais
Link not working...

I've also just compiled an exe version if you find it easier just to run a program:

https://www.androidfilehost.com/?fid=385035244224410927

It does exactly the same as the script version, just compacted into an exe format. If you don't trust it then feel free to continue using the batch file.

EDIT: Fixed it, now it'll spit out the logs and the zip file into a dated sub folder.
Link not working... :eek:
 

CounterC

Senior Member
Oct 26, 2012
2,029
635
0
@ djsubterrain If I have a random reboot, can I just run this script after the system has booted again?
If I do that is the info what caused the random reboot included?

Great work.
 
  • Like
Reactions: gunnerhk

anupritaisno1

Senior Member
Apr 29, 2014
1,811
1,898
153
@ djsubterrain If I have a random reboot, can I just run this script after the system has booted again?
If I do that is the info what caused the random reboot included?

Great work.
No, it has to be run during the random reboot

My approach to this would be to do something like

Code:
while true;
do
dmesg >> /sdcard/log
done
Or

Code:
tail | dmesg >> /sdcard/log
But the tail method doesn't work for me
 
Last edited: