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

Article ID: KB32516

Type: Support Content

Last Modified: 06-11-2014

 

Product(s) Affected:

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

When troubleshooting issues with the BES10 Client, it may be necessary to obtain device logs from the Android device. This article explains how to use the Android Debug Bridge (ADB) and Dalvik Debug Monitor Server (DDMS) tools 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 only packages required are:

  • 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 BES10 Client version 10.3.0.150345 and later.

Starting with BES10 Client version 10.3.0.150345, 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 3 for further information.

Note: When using this command, debug logging will be enabled until the device is restarted.


Task 3 - 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.
  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.

To output android Verbose logging including time stamp for events, mail and system buffers, enter the following commands:

adb shell setprop log.tag.opk.all V

Note: The above command will enable verbose logging until the device is restarted.

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

Note:

  • When running the command to display the device log inside the command prompt, the log will scroll live as actions are performed on the device and the two commands to output to a text file will not display any activity on the screen.
  • Press Ctrl+Break on the computer to stop the log output.


Method 2 - Using the Dalvik Debug Monitor tool

A DDMS.bat file can be found under C:\Program Files\Android\android-sdk\tools.

Ensure the Android device is connected to the computer and run the DDMS.bat file. This will open the Dalvik Debug Monitor.

Note: If the connected device is not detected, see Method 1 for steps to enable USB Debugging and install USB Drivers specific to the manufacturer of the device.

The Android device should be listed in the top-left pane and the device log will be displayed in the lower-right.

The device log will scroll the current log and entering a filter of fusion can help narrow down entries specific to the BlackBerry Mobile Fusion client. Ensure verbose is selected from the drop-down list for the most detailed logging.

When complete, the device log can be saved by clicking the Export Selected Items To Text File button.

Note: Remove any filters prior to saving to a text file to ensure that the entire log is saved.

The Dalvik Debug Monitor also has other useful tools available from the Device menu such as:

  • Screen capture
  • File Explorer
  • Show process status
  • Dump app state
  • Dump radio state
  • Run logcat
CollapseAdditional Information
There are applications available in Google Play which can be installed on the device itself to display the device log. Examples of such are aLogcat and SendLog. However, these applications cannot be used to collect entire Android log due to a security feature that was introduced in OS version 4.1 and now every Android application can read only it's own log. For an additional information see https://play.google.com/store/apps/details?id=org.l6n.sendlog&hl=en_GB

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.