How to generate Android device logs using ADB method?
In some instances, MDM support technicians might need the logs of the managed devices to understand the issue better and resolve the issues quickly. If the issue at hand pertains to MDM App, the logs can be directly collected from the app as explained in this document. But if there is an issue at the device level, you need to generate ADB logs.
Follow the steps given below to generate ADB logs using Windows PC.
- On the managed device, open the Settings app.
- Navigate to About Phone -> Build Number. Click on it 6 to 7 times, upon which You are now a developer is shown.
- Now, navigate back to Settings -> Developer Options and select the option Enable USB debugging.
- Again, navigate back to Settings ->Security. Enable Install from unknown sources.
- Connect the device to a computer through USB.
- On the computer, download the ADB Zip file from this link and unzip its contents.
- Once the contents in makedeviceowner.zip are extracted, open makedeviceowner folder.
- Now, open Command Prompt in the expanded folder and execute the command adb devices, which will show you the connected devices.
- Then execute adb logcat > file.txt command. This will generate the ADB logs and the logs will be saved to the file.txt file.
- Reproduce the issue on the Android device and press Ctrl+C on the Terminal Window to stop debugging.
- You can now share the file.txt file to MDM Support team.
Follow the steps below to collect ADB logs on a Mac device:
- Download and install Android SDK on the Mac. Android SDK will launch automatically. Select and install Android Platform tools.
- Connect the Android device to your Mac through USB cable.
- Open a new Terminal, change the working directory to the path where Android SDK is installed by running the command cd [path where Android SDK resides]/platform-tools.
- Run the command ./adb kill-server
- Run the command ./adb devices to list the devices connected to your Mac. Note the device ID of the devices for which you need to collect the logs.
- Run ./adb logcat -v threadtime [device ID] > /tmp/android-debug.log. Enter the device ID obtained in the previous step in the place of Device ID.
- Reproduce the issue on the Android device and press Ctrl+C on the Terminal window to stop debugging.
- The debug data will be available in the android-debug.log file.
- You can now share the android-debug.log file to MDM Support team.
Note: If you do not have access to collect the logs, run the command ./adb root before running the command ./adb logcat -v threadtime [device ID] > /tmp/android-debug.log