Where can I find OneAgent files and logs?

You may at some point want to access the installed OneAgent binaries, configuration files, and log files (for example, for support purposes). Here's where you can find these files.

By default your Dynatrace OneAgent is installed in the following directory:

  • On 64-bit Windows C:\Program Files (x86)\dynatrace\oneagent
  • On 32-bit Windows C:\Program Files\dynatrace\oneagent
  • On Linux /opt/dynatrace/oneagent

Exception for OneAgent v1.102 and earlier

Log files

Log files are stored by default:

  • On Linux at /opt/dynatrace/oneagent/log

  • On Windows at %ProgramData%\dynatrace\oneagent\log

  • On Azure at D:\home\DynatraceOneAgent\log and D:\home\SiteExtensions\Dynatrace\log.txt

On Cloud Foundry

  • For the Java buildpack at <path-to-app-container>/.java-buildpack/dynatrace_one_agent/log, you can stream logs in Cloud Foundry via CLI cf logs app-name.
  • For the Node.js, Staticfile, and PHP buildpacks as well as the NPM module, log files are located at <path-to-app-container>/dynatrace/oneagent/log.
  • For full-stack Dynatrace OneAgent deployed via the BOSH add-on, log files are located at /var/vcap/data/dynatrace/oneagent/log. Log files can additionally be found at the default path /opt/dynatrace/oneagent, which is a symlink to /var/vcap/data/dynatrace/oneagent/log. Note that /var/vcap/data/dynatrace is only accessible as root (i.e., sudo -s is required).

Logging for iOS

You can enable logging for iOS by adding the following snippet to Info.plist or Dynatrace.plist.

<key>DTXLogLevel</key>
<string>FINER</string>

Info.plist can be found in the Xcode Project Navigator under Supporting Files (or under Resources for older project files). Dynatrace.plist is created by the developers if they want to keep the Info.plist clean, so the location can vary.

Available log levels are ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF.

When running the app, you'll find the log in Xcode within the console of the Debug area.

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.

Alternatively:

  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. Extract/print the log to a file.

Logging for OpenKit

There are two different ways to log with OpenKit

  • Configure OpenKit to use the built-in console logger
  • Configure OpenKit to use a custom logger implementation

Log using the console logger

OpenKit includes a console logger. By default any error or warning message is logged to stdout. By enabling the verbose mode, all log messages (debug, info, warnings, and errors) are logged.

OpenKit openKit = new DynatraceOpenKitBuilder(endpointURL, applicationID, deviceID)
    .enableVerbose()  // 
    .build();

Log using a custom logger

OpenKit can also be configured with a custom logger implementation. Implement a custom logger to log OpenKit messages using the logging framework of your choice.

import com.dynatrace.openkit.api.Logger;

class MyLoggerImpl implements Logger {
  // implement interface methods
}

Logger logger = new MyLoggerImpl();

OpenKit openKit = new DynatraceOpenKitBuilder(endpointURL, applicationID, deviceID)
    .withLogger(customLogger)
    .build();