Chat SDKs Android v3
Chat SDKs Android
Chat SDKs
Android
Version 3
Sendbird Chat SDK v3 for Android is no longer supported as a new version is released. Check out our latest Chat SDK v4

Logger

Copy link

Sendbird Chat SDK for Android offers a logging system that allows you to keep track of a number of events and activities including data flow, error, and information while running your application. You can closely monitor the operation of the Sendbird SDK and improve debug efficiency using our logging system.


Log levels

Copy link

The logger of Sendbird Chat SDK for Android is based on the log levels classified by Android. Log levels can be used to categorize and control log outputs. There are a total of six log levels, which are ALL (VERBOSE), DEBUG, INFO, WARN, ERROR, and NONE. Except NONE, five different log levels take precedence over the other in the following order: ALL (VERBOSE) > DEBUG > INFO > WARN > ERROR. Or you can use NONE in order not to keep Sendbird logs.

LevelDescription

NONE

No logs recorded.

ALL

Logs all detailed information of the events and activities, as well as the log messages in DEBUG, INFO, WARN, and ERROR.

DEBUG

Logs what's happening inside the SDK that could be helpful to debug unexpected behaviors, as well as the log messages in INFO, WARN, and ERROR.

INFO

Logs the general events that take place in the Sendbird SDK, as well as the log messages in WARN and ERROR.

WARN

Logs unexpected events which wouldn’t affect the operation of Sendbird SDK but might cause problems. This log level also shows the log messages in ERROR.

ERROR

Logs what have caused failures in the specific events, but not a Sendbird SDK-wide failure.

Note: If an unexpected behavior is caused by a user's mistake or environmental factors, the behavior falls into WARN. If it is due to the Sendbird SDK or Sendbird internal operations, it falls into ERROR.


How to configure the log level

Copy link

The default log level set for Sendbird Chat SDK for Android is LogLevel.WARN, which means that Sendbird Chat SDK will keep logs of both errors and warning messages. You can change the settings through the setLoggerLevel() method in the SendBird class as follows:

SendBird.setLoggerLevel(SendBird.LogLevel.VERBOSE);
ParameterTypeDescription

level

LogLevel

Specifies the severity level of log to retrieve. One takes precedence over the other in the order of VERBOSE, DEBUG, INFO, WARN, and ERROR. You can also use NONE in order to not record Sendbird logs.

The following sample code demonstrates what Sendbird Chat SDK prints for each log level.

@deprecated
function submit_to_server(msg: String) {
    Logger.d("msg=" + msg) // This is a DEBUG log with a message.
    Logger.w("this method is deprecated. Please use submit_to_server_V2 instead.") // This is a WARN log.

    retry_count = 0
    response = null
    success = false

    while (retry_count is less than 3) {
        success = server.submit(msg)
        if (success) break

        Logger.e("submission failed with reason=" + server.get_last_fail_reason) // This is an ERROR log containing the cause of the error.
        Logger.v("retry_count=" + retry_count) // This is a VERBOSE stating the retry count.
        retry_count++
    }

    if (success) {
        Logger.i("echo succeeded with parameter msg=" + msg) // This is an INFO log with a message.
        return
    }

    Logger.i("echo failed with parameter msg=" + msg)
}

Log filtering

Copy link

All Sendbird Chat SDK log messages are tagged with Sendbird. If you want to see the log messages from Sendbird Chat SDK, search for the messages with a keyword Sendbird.