Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-7962

Program context information is not available for log appender

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.0, 3.5.2
    • Fix Version/s: 4.1.0
    • Component/s: None
    • Labels:
    • Release Notes:
      Program context information, including namespace, program name, and program type, are now available in the MDC property of each ILoggingEvent emitted from a program container.
    • Rank:
      1|hzzr8n:

      Description

      With the introduction of program.container.dist.jars by CDAP-6183, custom log appender can be added to program container. However, the program context information (e.g. namespaceId, instanceId, runId...) are not available through the `ILoggingEvent` as received by log appender.

      Apparently the current logic is to have those information stored inside a ThreadLocal in LoggingContextAccessor, and retrieved directly from co.cask.cdap.logging.appender.LogAppender class. For 3rd party log appender, they are not inherited from the CDAP LogAppender class, hence they have no access to those information.

      I believe we were using the ThreadLocal is because we need to make it work in SDK, as there is only one logback LoggerContext. However, in distributed mode, we should set those context properties into the LoggerContext property map so that it is visible for any log appender, instead of just the CDAP one.

        Attachments

          Activity

            People

            • Assignee:
              terence Terence Yim
              Reporter:
              terence Terence Yim
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: