> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# Android: Collecting logs

This article will help you to collect logs from Android SDK and WebRTC.

## Collect Logcat logs (from Android Studio)

Logcat is a command-line tool that dumps a log of system messages when the device throws an error and sends messages that you have written from your app with the `Log` class.

1. Open **Logcat** tab in Android Studio or select **View** → **Tool Windows** → **Logcat** from the menu bar.
2. Filter device logs by the `VOXSDK` tag.
3. We recommend enabling `timestamp` in `Datetime` format and `thread id` in the **Logcat Formatting Options**.

![Logcat](https://files.buildwithfern.com/voximplant.docs.buildwithfern.com/6a08fa356f0aef17fcfbc55f430b920f0df59465ac09e394f888305e88c46081/docs/assets/platform/sdks/guides-troubleshooting-logsandroid-logcat.png)

![Logcat Formatting options](https://files.buildwithfern.com/voximplant.docs.buildwithfern.com/78e335c295ac4d146eca9033db4027b43ed01f81ca1f444e21fe4ac080cf0268/docs/assets/platform/sdks/guides-troubleshooting-logsandroid-options.png)

4. Reproduce the problem
5. Once the problem is reproduced, select all logs in the logcat with `Ctrl + A` (Windows, Linux, Chrome OS) or `⌘ + A` (Mac), paste it into any text editor, and save the file. The recommended file extensions are “.log” and “.txt”

Learn more about Logcat in the [Android Developers](https://developer.android.com/studio/command-line/logcat) user guide.

## Collect logs to file (from Application)

Voximplant Android SDK provides the [ILogListener](https://voximplant.com/docs/references/androidsdk/client/iloglistener) interface that allows developers to collect the SDK log messages and save them in any convenient place, for example into a file.

[ILogListener](https://voximplant.com/docs/references/androidsdk/client/iloglistener) interface allows the applications to implement a log handler method that provides the following information:

1. log message level represented by [LogLevel](https://voximplant.com/docs/references/androidsdk/client/loglevel) enum
2. log message in String format

A file logger can be configured at an application startup.

```kotlin title="Sample FileLogger"
// (1) should implement ILogListener interface
class FileLogger(context: Context) : ILogListener {
    private lateinit var fileHandler: FileHandler

    init {
        // The log file is saved to the `data/data/app_name/` directory.
        fileHandler = FileHandler(context.filesDir.path + "/VOXSDK.log").apply {
            formatter = SimpleFormatter()
        }
        // (2) Invoke Voximplant.setLogListener() to handle Voximplant SDK log messages.
        Voximplant.setLogListener(this)
    }

    // (3) Write a log message in ILogListener.onLogMessage to a file.
    override fun onLogMessage(level: LogLevel, log: String) {
        val logLevel = when (level) {
            LogLevel.ERROR -> Level.SEVERE
            LogLevel.WARNING -> Level.WARNING
            LogLevel.INFO -> Level.INFO
            LogLevel.DEBUG -> Level.CONFIG
            LogLevel.VERBOSE -> Level.FINEST
        }
        fileHandler.publish(LogRecord(logLevel, log))
    }
}
```

## Extended logs

Voximplant Android SDK allows developers to enable extended logs that include WebRTC logs of level info, warnings, and errors.

It is important to consider that extended logs will lead to a significant increase in the volume of logs, and may also affect application performance. It is recommended that extended logs are enabled only for diagnosing problems with audio and video transmission and at the request of technical support specialists.

To enable extended logs, use [ClientConfig.enableDebugLogging](https://voximplant.com/docs/references/androidsdk/client/clientconfig#enabledebuglogging) on the SDK initialization:

```kotlin title="enableDebugLogging"
val clientConfig = ClientConfig().apply {
    enableDebugLogging = true
}
Voximplant.getClientInstance(Executors.newSingleThreadExecutor(), context, clientConfig)
```