> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spikeapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Android SDK Logging

> Getting logs for troubleshooting and debugging from Spike SDK for Android platform.

## Code Examples

By default, SPike SDK logs are sent to standard Android Logcat. If for some reason you want to read them, you can use the following code (running it before you start using SpikeSDK):

```kotlin theme={null}
SpikeConnectionAPIv3.setLogCallback { level, message ->
    when (level) {
        LogLevel.VERBOSE -> {}
        LogLevel.DEBUG -> if(BuildConfig.DEBUG) { 
            Log.d("SpikeSDK", message)
        }
        LogLevel.WARNING -> Log.w("SpikeSDK", message)
        LogLevel.ERROR -> Log.e("SpikeSDK", message)
    }
}
```

If you use Background Delivery, this code should be run in your application's onCreate() method:

```kotlin theme={null}
class MyApplication: Application() {
    override fun onCreate() {
        super.onCreate()

        SpikeConnectionAPIv3.setLogCallback { level, message ->
            when (level) {
                LogLevel.VERBOSE -> {}
                LogLevel.DEBUG -> if(BuildConfig.DEBUG) { 
                    Log.d("SpikeSDK", message)
                }
                LogLevel.WARNING -> Log.w("SpikeSDK", message)
                LogLevel.ERROR -> Log.e("SpikeSDK", message)
            }
        }
    }
}
```

Also, the application should be set in AndroidManifest.xml:

```kotlin theme={null}
<application
    android:name=".MyApplication"
    ...
>
```
