How to get logs from your Android device

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:
https://www.youtube.com/watch?v=smOzLSTaso0

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

./adb logcat > (path)

or on current directory

./adb logcat > log.txt

If you have more than one device connected, list your devices

./adb devices

And use -s flag

./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:

Logcat command-line tool | Android Studio | Android Developers

Logcat is a command-line tool that dumps a log of system messages, including stack traces, when the device throws an error and sends messages that you have written from your app with the Log class.

https://developer.android.com/studio/command-line/logcat

Video tutorial:
https://www.youtube.com/watch?v=DoKk_M4qArw

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

Popular Posts

[TOOL] Unity Assets Bundle Extractor

Il2CppDumper GUI Android App