Last modified July 27, 2021 by Shelly Wolfe

How do I configure SDK device logging?

By default, the Swrve SDK performs native device logging on iOS (Console Logs), Android (Logcat) and Unity. If required, you can disable these logs. On Android and iOS, you can also change the default logging level.

Additionally, the Swrve Unity SDK creates a small delay of approximately 14 milliseconds (ms) when logging. This is a not a big issue, however it can cause some performance implications if you’re firing events and your app operates at a high speed (for example, 60 frames per second, as you only have 16ms per frame). This article explains how to disable SDK device logs for iOS, Android and Unity.


If using source code

To disable the console logs completely on iOS, add a constant called SWRVE_DISABLE_LOGS to the preprocessor macros under App Target > Build Settings > Preprocessing > Preprocessor Macros.

If using CocoaPods

Add the following code to your podfile and reinstall the pod.

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'SWRVE_DISABLE_LOGS=1']

If using Carthage

In the SwrveFrameworks project in the Carthage/Checkouts/swrve-ios-sdk/SwrveFrameworks folder, add a constant called SWRVE_DISABLE_LOGS to the preprocessor macros, and then run a Carthage build to update your main project.

Configure log level at runtime

As of iOS SDK 7.0.0, you can configure the runtime log level. Call [SwrveLogger setLogLevel:VERBOSE] with any of the following SwrveLogLevel enums:

  • NONE


You can disable the Logcat logs on Android via the SwrveConfig object you use to create the Swrve instance. To disable the logs, call config.setLoggingEnabled(false) and include it in the SwrveSDK.createInstance method.

To set the logging level, call SwrveLogger.setLogLevel(logLevel).

Alternatively, to set the logging level using adb, run the following command:

adb shell setprop log.tag.SwrveSDK <loglevel>

For example, to change the logging level to DEBUG:

adb shell setprop log.tag.SwrveSDK DEBUG

Log levels supported:

  • INFO
  • WARN

To get the current logging level on a device, run the following adb command:

adb shell getprop log.tag.SwrveSDK

To use your own custom Timber Tree with Swrve and manage output to Logcat yourself, call SwrveLogger.useCustomLogger(true) so the SwrveLogger Tree does not get planted. This means you will see all Swrve logging regardless of log level for SwrveSDK. You can filter these by implementing Timber.Tree.isLoggable(String tag, int priority). For example, the code below filters out all Swrve logging less than WARNING level:

protected static class CustomTree extends Timber.DebugTree {
    protected boolean isLoggable(String tag, int priority) {
        return !tag.equals(SwrveLogger.LOG_TAG) || (tag.equals(SwrveLogger.LOG_TAG) && priority > Log.WARN);


This log does not affect release builds. To disable the Swrve SDK logging in your app, set the logging level to disabled.

SwrveLog.Level = SwrveLog.LogLevel.Disabled;