Debug logging for OneAgent

To troubleshoot support tickets you might have to enable and collect the debug logs of OneAgent.

Note: Debug flags are used explicitly for debugging purposes, not for production. They don't affect the working of the app or the instrumentation. We recommend that these flags be removed when building your PlayStore or production app because the additional logging can slow down the app or print sensitive data.

Activate debug logging mode

You can either activate the debug logs via the Dynatrace Android Gradle plugin or the OneAgent SDK.

Dynatrace Android Gradle plugin

You can activate debug logging via the agentLogging property.

dynatrace {
    configurations {
        sampleConfig {
            debug {
                agentLogging true
            }
        }
    }
}

OneAgent SDK

You can activate debug logging with the ConfigurationBuilder.withDebugLogging(boolean) method.

Dynatrace.startup(this, new DynatraceConfigurationBuilder("<YourApplicationID>", "<ProvidedBeaconURL>")
	.withDebugLogging(true)
	.buildConfiguration());

Retrieve logs from the device

OneAgent for Android uses the default log framework from Android. You can use the logcat monitor from Android Studio or the logcat command-line tool to view these log lines. The following steps must be performed to retrieve the Android logs via Logcat view in Android Studio:

  1. Connect the device to your PC (or run the emulator). Check that your device is set up for development.
  2. Open the Logcat view in Android Studio and select the device.
  3. Configure the Dynatrace OneAgent logcat filter with the regex (dtx|caa-a).* for the Log Tag field.
  4. Launch the instrumented app by using the debug flags.
  5. Copy and paste the log lines into a text file that can be opened with a text editor.