How to capture debug and verbose device logs from an Android device

Article ID: KB32516

Type: Support Content

Last Modified: 06-12-2015

 

Product(s) Affected:

  • BES12
  • BES10
  • BES10 Client for Android
  • Universal Device Service
CollapseEnvironment
  • BlackBerry Enterprise Service 10
  • BlackBerry Enterprise Service 12
  • Universal Device Service  
  • Android devices
  • Android Software Development Kit
CollapseOverview

When troubleshooting issues, it may be necessary to obtain device logs from the Android device. This article explains how to use the Android Debug Bridge (ADB) found in the Android SDK (Software Development Kit) to turn on debug logging and if necessary, obtain the most verbose device logs possible.


Task 1 - Download and install the Android SDK on a computer.

The following packages are required:

  • Android SDK Platform-tools
  • Google USB driver

Note: The Android SDK Manager may default to selecting one of the Android version API packages (for example, Android 4.1 (API 16)) for install. These are not needed and can be unchecked.

Task 2 - Enable debug logging for the BES12 Client

Debug logging is disabled by default for security reasons. To enable debug logging, connect the device via USB and type the following ADB command in the command line:

adb shell setprop log.bb.debug <srp>


Where <srp> is your BlackBerry Enterprise Server's SRP id.

For example: adb shell setprop log.bb.debug s1234567
If having difficulty getting the device detected, see Method 1 in task 4 for further information.

Note: Debug logging will only be enabled until the device is restarted.

Task 3 - Enable debug logging for the specific Secure Work Space issue being troubleshot using the following debug settings:

adb shell setprop debug.opl.adam V for ADAM only (always use this)
adb shell setprop debug.opl.exchange V for ActiveSync only
adb shell setprop debug.opl.email V for email only (POP/IMAP)
adb shell setprop debug.opl.browser V for Browser only
adb shell setprop debug.opl.calendar V for Calendar only
adb shell setprop debug.opl.launcher V for Launcher only
adb shell setprop debug.opl.contacts V for Contacts only
adb shell setprop debug.opl.dialer V for dialer only
adb shell setprop debug.opl.docstogo V for Docs2Go only
adb shell setprop debug.opl.gallery V for Gallery only
adb shell setprop debug.opl.media V for Media only
adb shell setprop debug.opl.mms V for MMS only
adb shell setprop debug.opl.phone V for Phone only
adb shell setprop debug.opl.androidterm V


Task 4 - Complete the log capture by using one of the following methods:

Method 1 - Using the ADB.exe tool

  1. Open Command Prompt and navigate to:
    C:\Program Files\Android\android-sdk\platform-tools.
  2. Connect the Android device to the computer via USB and run the following command:
    adb devices

At this point, the device may not be detected. The command prompt will display List of devices attached with no devices listed below.

If this occurs, ensure that USB Debugging is enabled on the device. This can commonly be enabled on the device by navigating to one of the following:

  • Settings > Applications > Development > USB Debugging
  • Settings > Apps > Development options > USB Debugging

For Android 4.2 or later the following steps will be required to enable USB Debugging on the device:

  1. Tap Settings > About Tablet/device.
  2. Tap Build Number seven times (this will make Developer Options available in the menu).
  3. Tap Settings > Developer Options.
  4. Enable the Developer Options and USB Debugging settings.
  5. Tap Settings > Storage.
  6. In the menu select Configure USB Computer Connection
  7. Select to use the device as a Camera.

Note: If USB Debugging is enabled on the device and the adb devices command does not detect the device, the desktop software (which will include USB drivers) for the specific device will need to be installed. For example, for a Samsung device, install Kies Air or for a Motorola device, install Motorola Device Manager. Contact the device's manufacturer for assistance.

The device is successfully connected when it is listed in the Command Prompt similar to the following:

List of devices attached
304D19FD104A60D1 device

Note: If the device is not listed in the command prompt as seen above after running the adb devices command, the steps below will be unsuccessful.  

adb logcat -v time -b events -b main -b system –b radio > c:\folder\AndroidVerbose.txt

Note:

  • When running the command to output to a text file, it will not display any activity on the screen.
  • Press Ctrl+Break on the computer to stop the log output.

Method 2 - Using the bug reporter built into Android OS

This is the preferred method, if it needs to be send wirelessly, as it will capture all logs from the OS and all applications running.

  1. Open Settings>More>Developer options
  2. Click Take bug report
  3. Send the report to the desired email address

Note: To capture more than 5 minutes or so worth of logs, modify the size of buffer under Settings > Developer options > Log Buffer Size > change to 16MB. This is only available in Android 5.x and later.

Method 3 - Using the bug reporter built into the BES12 client

This will only collect BES12 client logs, and no other app or OS level logs, which may not contain enough information to debug the issue.

  1. Open the BES12 client and click the 3 dots in the top right corner
  2. Click Help
  3. Click BUG REPORT in the top right corner
  4. Send the report to the desired email address

Method 4 - Using the bug reporter built into the Work Space MGR

This will only collect Secure Work Space logs, and no other app or OS level logs, which may not contain enough information to debug the issue.

  1. Open Work Space MGR
  2. Click Preferences > About
  3. Click Take bug report
  4. Send the report to the desired email address
CollapseAdditional Information

Additional logs to capture and collect:

  • adb shell getprop > C:\folder\device_properties.log

This will create a list of system properties, including device information, model, version, etc.

  • call adb shell "ls -lRa `ls | grep -v sys$ | grep -v proc$ | grep -v dev$`" > C:\Folder\ File_Permissions.log

This dumps the filesystem and permissions for each file.  Helpful when checking for rooted apps, etc.

  • call adb pull /data/log c:\folder

This will copy dumpstate logs for Samsung devices

  • call adb pull /data/anr/traces.txt C:\folder\ANR_Trace.log

This will copy crash logs

Disclaimer

By downloading, accessing or otherwise using the Knowledge Base documents you agree:

   (a) that the terms of use for the documents found at www.blackberry.com/legal/knowledgebase apply to your use or reference to these documents; and

   (b) not to copy, distribute, disclose or reproduce, in full or in part any of the documents without the express written consent of RIM.


Visit the BlackBerry Technical Solution Center at www.blackberry.com/btsc.