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

Program context information is not available for log appender


    • 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:


      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.




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


              • Created: