Logging for Android

Logging for Android involves two different logs:

  • Auto-instrumentor log
  • OneAgent log

Auto-instrumentor log

The auto-instrumentor publishes the debug logs into the console and into the auto-instrumentor log file (the file name starts with AIA and the current date). The log file is stored in the logs directory (root folder is the current working directory). To obtain the debug logs, the auto-instrumentation property DTXLogLevel must be added using the scripts instrument.sh/instrument.cmd.

  • Via Dynatrace Gradle plugin: Add the auto-instrumentation property DTXLogLevel':'debug' through the Dynatrace Gradle plugin property agentProperties to the Dynatrace configuration block in the build.gradle file. When the Android build process is triggered via the Run button from Android Studio, the console logs are displayed in the Gradle Console view. The log file is stored in the <project>/<module>/build/tmp/autoInstrument<build_variant>/logs directory.

  • Via console: Add the auto-instrumentation property DTXLogLevel=debug to the auto-instrumentor Dynatrace.properties file.

OneAgent log

To obtain the debug log for OneAgent from an application when DTXLogLevel=debug is enabled:

  1. Connect the device to your PC (or run the emulator). Check that your device is setup for development.
  2. Launch the command prompt/terminal.
  3. Run adb shell logcat > MyAndroidAppLog.txt For details, see Logcat.
  4. Launch the instrumented app with the new debug flags.


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

Debug flags are used explicitly for debugging purposes, not for production. As such, they won't affect how either the app or the instrumentation work. It's generally recommended that these flags be removed when building your PlayStore or production app, because the additional logging can slow down the app.