Skip to content

Capturing Logs From App

knamoach edited this page Aug 24, 2022 · 3 revisions

The user application can set log level of the logging and save log to files using Webex SDK interface.

Log level

There are following 7 levels for logging

public enum LogLevel {
    NO, ERROR, WARNING, INFO, DEBUG, VERBOSE, ALL
}

and the log level can be set with

webex.setLogLevel(Webex.LogLevel.DEBUG)

Log capture

Webex SDK offers a log capture utils to read from logcat

Webex SDK Log Capture
LogLevel.NO adb logcat *:S | grep <processId>
LogLevel.ERROR adb logcat *:E | grep <processId>
LogLevel.WARN adb logcat *:W | grep <processId>
LogLevel.INFO adb logcat SQ:W wels:W *:I | grep <processId>
LogLevel.DEBUG adb logcat SQ:W wels:W UTIL:W *:D | grep <processId>
LogLevel.VERBOSE adb logcat *:V | grep <processId>
LogLevel.ALL adb logcat *:V

and write the output to a rolling set of files in the app’s external cache/logs storage, which is /sdcard/Android/data/\<application package\>/cache/logs/ specifically. The number and size of files is currently hard-coded below and start at zero (e.g. cache/logs/ssdk0.log).

private static final int  MAX_DEBUG_LOG_FILES = 5;
private static final int  MAX_RELEASE_LOG_FILES = 5;
protected static final long MAX_LOG_FILE_SIZE = 20 * 1024 * 1024; // 20MB file size

Getting logs from the device via ADB

  • Enable developer options in the android device. Go to Settings->About phone Tap on "Build number" repeatedly. A notification would popup when "Developer options" menu is enabled. These instructions can vary device to device. Please refer to manufacturer's manual for device specific instructions

  • Go to "Developer options" menu and enable "USB debugging".

  • Download adb tool from android developer website

  • Find the ip address of android device from Network settings

  • Execute below command from terminal

<adb executable path> connect <ip of android device>

eg: adb connect 192.168.1.11
  • Click allow debugging if prompted on android device

  • Once connected use below command to get the logs from the device

adb pull /sdcard/Android/data/com.cisco.sdk_android 

Note: Both PC and android device needs to be in same network. Disconnect from VPN before connecting via ADB

Clone this wiki locally