Optimizely will be sunsetting Full Stack Experimentation on July 29, 2024. See the recommended Feature Experimentation migration timeline and documentation.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySumbit a ticketLog In
GitHubNuGetDev CommunitySumbit a ticket

Customize logger

This topic describes how to customize the log information about experiments to help with debugging.

The logger logs information about your experiments to help you with debugging. You can customize where log information is sent and what kind of information is tracked.

For the Android SDK, you can use our Android SLF4J logger. Logging verbosity can be controlled via the android-logger.properties file. This file can be placed in src/main/resources. You can also include a copy in src/release/resources with different settings for the build you release to the Play Store. Read about advanced configuration options.

To improve your experience setting up the SDK and configuring your production environment, we recommend that you pass in a logger for your Optimizely client. See the code example below.

❗️

Warning

Due to a recently announced security exploit in the Log4J library, we recommend upgrading to version 2.15.0 or higher as soon as possible if you are using it alongside the SDK. View Apache's documentation on the Log4j vulnerability for more information.

# android-logger.properties example (JSON)

# Java Core SDK
logger.com.optimizely.ab.Optimizely=DEBUG:Optly.core
logger.com.optimizely.ab.annotations=DEBUG:Optly.annotations
logger.com.optimizely.ab.bucketing=DEBUG:Optly.bucketing
logger.com.optimizely.ab.config=DEBUG:Optly.config
logger.com.optimizely.ab.error=DEBUG:Optly.error
logger.com.optimizely.ab.event=DEBUG:Optly.event
logger.com.optimizely.ab.internal=DEBUG:Optly.internal

# Android SDK
logger.com.optimizely.ab.android.sdk=DEBUG:Optly.androidSdk
logger.com.optimizely.ab.android.event_handler=DEBUG:Optly.eventHandler
logger.com.optimizely.ab.android.shared=DEBUG:Optly.shared
logger.com.optimizely.ab.android.user_profile=DEBUG:Optly.userProfile

# Disable most SDK logs by commenting all other lines and uncommenting below
# logger.com.optimizely.ab=ASSERT:Optly

Log levels

The table below lists the log levels for the Android SDK.

Log LevelExplanation
ERROREvents that prevent feature flags from functioning correctly (for example, invalid datafile in initialization and invalid feature keys) are logged. The user can take action to correct.
WARNEvents that don't prevent feature flags from functioning correctly, but can have unexpected outcomes (for example, future API deprecation, logger or error handler are not set properly, and nil values from getters) are logged.
INFOEvents of significance (for example, activate started, activate succeeded, tracking started, and tracking succeeded) are logged. This is helpful in showing the lifecycle of an API call.
DEBUGAny information related to errors that can help us debug the issue (for example, the feature flag is not running, user is not included in the rollout) are logged.