Tutorial How to get logs from your Android device

AndnixSH

PMT Elite Modder
Original poster
Staff member
Modding-Team
Jun 27, 2017
4,756
300,804
1,213
Modding World
Logcat is the Android logging system provides a mechanism for collecting and viewing system debug output. Logs from various applications and portions of the system are collected in a series of circular buffers.

Non-rooted device:
First, you must enable USB debugging on developer options on your Android device. Go to Settings, About phone and tap the Build Number option 7 times. You can find this option in one of the following locations, depending on your Android version:
  • Android 9 (API level 28) and higher: Settings > About Phone > Build Number
  • Android 8.0.0 (API level 26) and Android 8.1.0 (API level 26): Settings > System > About Phone > Build Number
  • Android 7.1 (API level 25) and lower: Settings > About Phone > Build Number
After that, you can find this option in one of the following locations, depending on your Android version:
  • Android 9 (API level 28) and higher: Settings > System > Advanced > Developer Options > USB debugging
  • Android 8.0.0 (API level 26) and Android 8.1.0 (API level 26): Settings > System > Developer Options > USB debugging
  • Android 7.1 (API level 25) and lower: Settings > Developer Options > USB debugging
After enabling USB debugging, it will allow Android Studio and other SDK tools to recognize your device when connected via USB on your computer. Allow the device to be trusted when asked.

Matlog app (Recommended):
Without root, a computer is required to grant permission to access logs for matlog. You must know basics how to use CMD/Terminal, we won't cover it here.

Download Matlog for Android: Releases · AndnixSH/matlog

Download standalone SDK Platform Tools for Windows/Mac/Linux: SDK Platform Tools release notes | Android Developers

Open CMD/Terminal.

Navigate to platform tools directory

Copy and paste this command into CMD/Terminal
Code:
./adb shell pm grant com.pluscubed.matloglibre android.permission.READ_LOGS
1658422735965.png


See more about ADB: Android Debug Bridge (adb) | Android Developers

Now you can record logs

File location:
  • Android 11 and above: /storage/emulated/0/Documents/matlog/savedlogs
  • Android 10 and below: /storage/emulated/0/matlog/savedlogs

1658423087137.png

Android Studio:
Android Studio might be complicated to setup, but the logcat interface is easier to use

Download Android Studio for Windows/Mac/Linux: Download Android Studio & App Tools - Android Developers

Install Android Studio: Install Android Studio | Android Developers

After installation, open Android Studio and create a new project.

At the bottom of toolbar, open the logcat. Your device should be detected, and will constantly sending logs.

1658417819502.png


To save logs, simply select all (CTRL + A), copy (CTRL + C) and paste (CTRL + V) onto text editor, and save as text file.

Video tutorial:

ADB command line (Advanced):
Download standalone SDK Platform Tools for Windows/Mac/Linux: SDK Platform Tools release notes | Android Developers

Open CMD/Terminal

Navigate to platform tools directory

Type

Code:
./adb logcat > (path)
or on current directory

Code:
./adb logcat > log.txt
If you have more than one device connected, list your devices

Code:
./adb devices
And use -s flag

Code:
./adb -s (device name) logcat > (path)
Nothing will appear on the prompt but it is actually running, it is because the output are saving to disk directly. To stop logging, simply close the window

1658423006447.png


See more about adb logcat:

Video tutorial:

Rooted device/emulator/virtual machine:
Download Matlog for Android: Releases · AndnixSH/matlog

Grant root permission

Now you can record logs

File location:
  • Android 11 and above: /storage/emulated/0/Documents/matlog/savedlogs
  • Android 10 and below: /storage/emulated/0/matlog/savedlogs
1658423087137.png
 
Last edited: