Last modified January 14, 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, 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 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.


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

To change the logging level run the following adb command:

adb shell setprop log.tag.SwrveSDK <loglevel>

where <loglevel> is a value from 2 to 6.

For example, to change the logging level to DEBUG:

adb shell setprop log.tag.SwrveSDK 3

Log levels supported:

  • VERBOSE = 2
  • DEBUG = 3
  • INFO = 4
  • WARN = 5
  • ERROR = 6

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;