[IN-DEPTH] 3 ways to capture and debug logcat

By October 5, 2018 How to

 

Hello my lovely readers and GlamourROM fans.

I’ve run into so many questions from people regarding how to logcat. So I decided to write a guide for all of you which talks about 3 different ways and I’m sharing here only my preferences. Of course there are more methods, but at the moment I’m sticking with these.

Logcat methods:

 

  • Catlog (Android App)
  • Minimal ADB
  • Android Monitor(GUI)

Choose one and lets continue.

app-icons

Catlog

 

First of all you will need root if you choose this method, because it will give superuser rights to Android logcat app. Magisk rooting method is highly preferred. App I’m using in this tutorial is CatLog. Click here to download it.

App description:

Debug your apps. Find error stacktraces. See what your phone is saying about you behind your back. It’s all there in the system log, aka logcat!

catlog
Enter your tag or keyword
Select filter

Minimal ADB

 

Prerequisites:

  • Your device is plugged into your computer
  • You have USB Debugging enabled under Developer Options (Note: This may be listed as ADB Debugging on some ROM’s)
  • You have installed the necessary drivers and your computer is recognizing your device

Head over to AndroidFileHost site. Download installer from there. By default it will install to C:\Program Files (x86)\Minimal ADB and Fastboot. It is preferred to make shortcut. After install open the command line app. Test if your device can be found at all. I type “adb devices” and outcome will be like this:

PS C:\WINDOWS\system32> adb devices

List of devices attached

ad0117020d208b226b      device

Which says that device is perfectly recognized and you can proceed with it. You might drive into opposite response from terminal called device unauthorized. In that case you must revoke USB debugging on phone. Here is already written guide for that.

Priority lists:

  • V — Verbose (lowest priority)
  • D — Debug
  • I — Info
  • W — Warning
  • E — Error
  • F — Fatal
  • S — Silent (highest priority, on which nothing is ever printed)

You want to set it as error and above to filter unneeded ballast. Command will be like that:

adb logcat *:E >> %userprofile%\Desktop\log.txt

If you want to stop the logging press Ctrl + C or simply unplug your phone.

You will find log.txt transferred in your Desktop.

Android Device Monitor

 

My preferred method. Tool is deprecated but works really well. This zip is packed from android sdk folder.

Download this:

Extract it and start the tool by clicking on monitor.exe.

android-device-manager
Your device ready to debugging
Here you can filter your logs
Log filter itself

Really great GUI solution, all interactive and so on.

Filtering FC log simply write tag:AndroidRuntime to bar for example.

Analyzing logs:

Example of system crashing error:

E/AndroidRuntime: !@*** FATAL EXCEPTION IN SYSTEM PROCESS: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.settings/com.android.settings.Settings}: java.lang.NullPointerException

Caused by: java.lang.NullPointerException
at com.android.settings.Settings.updateHeaderList(Settings.java:594)
at com.android.settings.Settings.onBuildHeaders(Settings.java:530)

For example in this above error this means that somewhere in your code something is set to null and you are trying to use it as though it isn’t.

The next few lines tell you where in your code you can find the error. I’ve removed all the unnecessary lines from the stacktrace. Stacktrace says that method named updateHeaderList returns a null value. Problem here is a mismatching ID and resource call happens at line 530.

 

List of tags you should seek for:

AndroidRuntime – this is the main reason of continuous FC like SystemUI crash

DEBUG – usually bootloop, caused due to incomplete binary or library

JavaBinder – similar to ART one

Zygote – Most likely happening due to unproper porting

 

You can send me a error log if it’s Glamour ROM related.

Leave a Reply

Get more stuff

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

#GLMR