Setting up LTTng tracing for Content Delivery on Unix

Set up LTTng on your Content Delivery servers to trace the behavior of microservices. LTTng requires java.util.logging or Log4j logging to work, so you will need to replace the Logback logging framework, installed by default, with Log4j.

Procedure

  1. Using the instructions found at https://lttng.org/docs/#doc-installing-lttng, install the following LTTng components:
    • lttng-tools
    • lttng-modules-dkms
    • liblttng-ust-dev
    • liblttng-ust-agent-java
  2. From the Web address http://www.slf4j.org/download.html, download slf4j-log4j12-1.7.21.jar.
  3. From the Web address http://archive.apache.org/dist/logging/log4j/1.2.17/, download log4j-1.2.jar.
  4. Access the library location of a microservice you want to trace.
  5. Remove the following files:
    • log4j-over-slf4j-VERSION.jar
    • logback-classic-VERSION.jar
    • logback-core-VERSION.jar

    where VERSION is the version number of the JAR file (not necessarily the same number for all files).

  6. Copy liblttng-ust-agent.jar from your LTTng installation folder (typically /usr/lib/lttng/java/) to the library location.
  7. Copy the two files you downloaded to the library location of the microservice.
  8. Access the configuration location of the microservice.
  9. Remove logback.xml.
  10. Follow the Log4j product documentation as found at https://logging.apache.org/log4j/1.2/manual.html to create a Log4j configuration file called log4j.properties in this location.
  11. Stop the microservice.
  12. In the start.sh file you use to start the microservice, add the string (--enable.lttng.tracing=true) to your ARGUMENTS string by adding the following line:
    ARGUMENTS+=(--enable.lttng.tracing=true)
  13. Start the microservice.
  14. Repeat steps 4-13 as needed to trace other microservices.

What to do next

LTTng tracing is enabled for the microservice(s) you modified. You can now create, stop and view tracing sessions.