Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-30788

Enable Log4j trace correlation with OpenCensus

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2021.1
    • Fix Version/s: 2021.16
    • Component/s: Monitoring
    • Release Notes Summary:
      The log4j trace now contains reference to the tracing identifier enabling correlation
    • Release Notes Description:
      Hide

      When using tracing the trace and span identifiers are now propagated to the log4j context map.
      This is accessible in log4j2 patternLayout using:

      %X{traceId}
      %X{spanId}
      

      or in contextMap when using the JSON format:

      ...
        "loggerFqcn": "org.apache.logging.log4j.jcl.Log4jLog",
        "contextMap": {
          "spanId": "4d45c80b79c59178",
          "traceId": "f0000000000000000000000000000000",
          "tx": "79ffffffbb66ffffffa07e10047544d4944"
        },
        "threadId": 205,
        "threadPriority": 5
      }
      
      Show
      When using tracing the trace and span identifiers are now propagated to the log4j context map. This is accessible in log4j2 patternLayout using: %X{traceId} %X{spanId} or in contextMap when using the JSON format: ... "loggerFqcn" : "org.apache.logging.log4j.jcl.Log4jLog" , "contextMap" : { "spanId" : "4d45c80b79c59178" , "traceId" : "f0000000000000000000000000000000" , "tx" : "79ffffffbb66ffffffa07e10047544d4944" }, "threadId" : 205, "threadPriority" : 5 }
    • Team:
      PLATFORM
    • Sprint:
      nxplatform #53, nxplatform #54
    • Story Points:
      2

      Description

      Today, we can activate tracing capabilities and export traces to Jaeger, Zipkin, or Datadog (https://doc.nuxeo.com/nxdoc/master/tracing/).
      But the trace identifier cannot be propagated to log4j in order to get trace and log correlation.

      Even if the opencensus-contrib-log-correlation-log4j2 jar is deployed in $NUXEO_HOME/nxserver/lib it looks like there is a classpath problem that prevents to make it work, probably because log4j is located in $NUXEO_HOME/lib.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: