Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1000

MDC default value is not parsed

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Major Major
    • None
    • 1.1.2
    • logback-classic
    • None

    Description

      If you want the default value of a MDC lookup to be the result of a different MDC lookup (or any other variable/substitution) it does not work.

      %X{mdcKey:-%X{defaultKey}} should be allowed. Instead if %X{mdcKey} is not defined the log output is the literal string "%X{defaultKey}" instead of performing an MDC lookup on the defaultKey.

      For example, we are trying to use the following pattern.

      <encoder>
          <pattern>%d{ISO8601} %-5level [%thread] [%X{signature}:%c{0}] %msg%n</pattern>
      </encoder>
      

      However, %c{0} is never parsed or turned into the name of the logger.

      Best I can tell from looking at the code the default value of a MDC token is never parsed.

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            kragoth Tim Evers
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: