Logging

The Airship SDK allows configuring different log levels that can be helpful for debugging issues.

The SDK offers several log levels that the SDK to prevent spamming the console. By default, the log level is set to info for development builds, and error for production builds.

Log levelDescription
VerboseUsed for reporting highly detailed SDK status that can be useful when debugging and troubleshooting.
DebugUsed for reporting general SDK status with more detailed information.
InfoUsed for reporting general SDK status.
WarningUsed for API deprecations, invalid setup and other potentially problematic situations. Warnings are generally recoverable by the SDK.
ErrorUsed for critical errors, parse exceptions and other situations that cannot be gracefully handled.
None/AssertNo log messages.

Configuring log levels

The log level is configurable through Airship config that is passed in during takeOff.

Example enabling verbose logs

// Available log levels: VERBOSE, DEBUG, INFO, WARNING, ASSERT
AirshipConfigOptions.newBuilder()
    .setDevelopmentLogLevel(Log.VERBOSE)
    .setProductionLogLevel(Log.VERBOSE)
    ...
// Available log levels: VERBOSE, DEBUG, INFO, WARNING, ASSERT
AirshipConfigOptions.newBuilder()
    .setDevelopmentLogLevel(Log.VERBOSE)
    .setProductionLogLevel(Log.VERBOSE)
    ...
let config = Config.default()
// Available log levels: VERBOSE, DEBUG, INFO, WARNING, NONE
config.productionLogLevel = .verbose
config.developmentLogLevel = .verbose
// Available log levels: VERBOSE, DEBUG, INFO, WARNING, NONE
UAConfig *config = [UAConfig defaultConfig];
config.productionLogLevel = UALogLevelVerbose;
config.developmentLogLevel = UALogLevelVerbose;
// Available log levels: verbose, debug, info, warning, none
await Airship.takeOff({
    default: {
        logLevel: "verbose"
    },
    ...
});

Due to how takeOff caches config, you may need to restart the app after the new takeOff before the log levels take effect.

  Airship.takeOff(
    AirshipConfig(
      defaultEnvironment: ConfigEnvironment(
        appSecret: "APP_SECRET",
        appKey: "APP_KEY",
        logLevel: LogLevel.verbose
      )
    )
  );
// Available log levels: verbose, debug, info, warning, none
Airship.takeOff({
  default: {
    logLevel: "verbose"
  },
  ...
});
// Available log levels: verbose, debug, info, warning, none
await Airship.takeOff({
    default: {
        logLevel: "verbose"
    },
    ...
});

Android airshipconfig.properties:

# Available log levels: VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT
productionLogLevel = VERBOSE
developmentLogLevel = VERBOSE

iOS AirshipConfig.plist:

<!--  Available log levels: TRACE, DEBUG, INFO, WARNING, NONE -->
<key>productionLogLevel</key>
<string>TRACE</string>
<key>developmentLogLevel</key>
<string>TRACE</string>

Android airshipconfig.properties:

# Available log levels: VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT
productionLogLevel = VERBOSE
developmentLogLevel = VERBOSE

iOS AirshipConfig.plist:

<!--  Available log levels: VERBOSE, DEBUG, INFO, WARNING, NONE -->
<key>productionLogLevel</key>
<string>VERBOSE</string>
<key>developmentLogLevel</key>
<string>VERBOSE</string>
// Available log levels: logLevelVerbose, logLevelDebug, logLevelInfo, logLevelWarning, logLevelNone
Airship.takeOff({
    default: {
        logLevel: Airship.logLevelVerbose
    },
    ...
});

Due to how takeOff caches config, you may need to restart the app after the new takeOff before the log levels take effect.

Log levels can be set within the Airship config menu.

Verbose logging

When trying to debug an issue with Airship, often times we will request verbose logs for an app session that reproduces the issue. You can verify verbose logs are enabled by checking the output in the console. On Android, you should see logs logging at the Verbose category with <App Name> - UALib tag:

Android verbose logs example
Sample - UALib com.urbanairship.sample V UAirship - !SDK-VERSION-STRING!:com.urbanairship.android:urbanairship-core:16.9.0

On iOS you should see [Airship] [V] as a prefix on the log message:

iOS verbose logs example
[Airship] [V] AirshipCore/TaskManager.swift attemptRequest(_:nextBackOff:) [Line 275] Task ChannelAudienceManager.update started