CS/IT Tutorials Collections

How to Capture Android Logs with Minimal ADB and Fastboot

Pinterest LinkedIn Tumblr
It’s required to capture the device log when crashes or any other error occurs while testing an android application. There are numbers of tools and methods are available that can be used for the purpose of recording logs. Although you can use the Android SDK tool to capture android logs. If you are using this software for capturing logs only, you can use a lightweight tool Minimal ADB and Fastboot instead of Android SDK. You can easily capture Android App logs and website logs with this simple tool. In this post, I am going to briefly explain how to set up your device, install the Minimal ADB and Fastboot App and use it to capture Android logs.

Setup Your Device

Before starting to record device log, you have to prepare your device to allow an ADB connection for collecting logs. For that, you have to enable USB debugging on your device. Use the following steps to enable USB debugging for Android 4.2 and higher, if you have not done already.

  1. Open the setting.
  2. Select developer options.
  3. If did not see developer options,
    • Go to About phone or tablet
    • Scroll to Build number and tap on it several times.
  4. On the developer options, scroll down to USB debugging and enable it.
    Enabling USB debugging options

Install Minimal ADB and Fastboot Tool

In order to install Minimal ADB and Fastboot tool on Windows, follow the steps given below.

  1. Download the installation file of Minimal ADB and Fastboot tool from here.
  2. Run the .exe file after the download completes.
  3. Click on Next button as on the image below, when the application set up wizard welcome screen appears.
    Install Minimal ADB and Fastboot Tool
  4. Complete the steps and select your installation destination location if required otherwise left the default location.
    Install Minimal ADB and Fastboot Tool
  5. Select the location for application shortcut file or leave the default location.
    Install Minimal ADB and Fastboot Tool
  6. After all the installation setting completes, click on the install button to start the installation.
    Install Minimal ADB and Fastboot Tool

Test The Installation

When the installation completed, you can open the application via short icon created while installing. When the command window of  Minimal ADB and Fastboot Tool opened, use these commands to check whether the application installed successfully or not.

adb version

This command will display the version info of ADB.

adb devices

This command will show the list of devices connected with the USB debugging option enabled. All the devices should be listed here, if not you should disconnect the ADB device and connect it again.

Recommended: How to Get Browser Console Logs While Testing Website

Start to Capture Android Logs

After successfully installing the tool, you can start to capture Android logs from any mobile application or mobile web. If you do not have enabled USB debugging on your phone or tablet, do it at first with referring to the instruction provided at the top of this post.  Follow the steps given below if you want to capture  Android logs from the mobile application or mobile web.

  1. Connect your phone or tablet to your computer using a USB cable.
  2. If you have connected this device for the first time, wait for driver installation to finish.
  3. Create or pick the destination folder for saving recorded log files. For example, you can create a folder named “logs” on D: drive.
  4. Copy the complete path of the file, for this right click on the address bar of file explorer and click on “copy address as text”.  If you have created the folder on the location mentioned in step 3, the path will be “D:\logs”.
  5. Launch the Minimal ADB and Fastboot application from its shortcut.
  6. Enter the command like “adb logcat > D:\logs\log.txt” and press Enter key for starting to capture logs. You can paste the previously copied folder path after the command “adb logcat >”.
  7. Now recording the logs will be started to your specified file and you will see the blank command screen.
  8. After you have finished reproducing the bug, you can stop the log transmission with simply pressing the CTRL+C key from the keyboard or you can even disable USB debugging option from your device. Now you will find the file with the logs recorded.

Setup to Capture Android Logs Automatically

You can even setup the batch file for recording the android logs automatically. For that, you have to save some command lines on the batch file and have to run the file from the same location of executable ADB and fastboot files installed. Copy the code given below and paste into a new notepad file.

set timestamp=%date:~10,4%-%date:~7,2%-%date:~4,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%
adb logcat -c
adb logcat>D:\logs\log-%timestamp%.txt

The command set timestamp will create the variable timestamp which will be used on a filename. The command “adb logcat -c” used on the second line will erase all the previous logs on your device.  You can update the file path with your file path located on the last line.

Save the file with the extension .bat.  Now, copy that file to “Minimal ADB and Fastboot” directory and create the shortcut of the file to the desktop. When clicking on the shortcut file, the command window will open and start to record the log. Press CTRL + C and press Y from the keyboard to stop the recording. The captured log will be saved on your provided location.

Read Next: How to Record Logs with Charles Proxy on Windows

Please follow and like us:
RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
linkedIn | How to Capture Android Logs with Minimal ADB and Fastboot
Share

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Comments are closed.

RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
Share