Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3074

Add replacement parameter to mdc resolver

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.14.1
    • 2.15.0
    • JsonTemplateLayout
    • None

    Description

      This story aims to add a replacement parameter to ReadOnlyStringMapResolver (which is used by ThreadContextDataResolver and MapResolver) for modifying the keys of the map before resolving them. That is, given the following JSON template

      {
        "user": {
          "$resolver": "mdc",
          "pattern": "user:(.*)",
          "replacement": "$1"
        }
      }
      

      A LogEvent with an MDC map composed of user:name, user:role, sessionId entries will generate the following JSON:

      {
        "user": {
          "name": "Paul Rubin",
          "role": "ADMIN"
        }
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              paulrubin37 Paul Rubin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: