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

Make "key" optional and add "flatten" to JsonTemplateLayout "map" resolver

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.14.0
    • 2.14.1
    • Layouts

    Description

      As reported by Magnus Kvalheim in a log4j2-logstash-layout issue, there is a request as follows:

      With the message resolver it's possible to set the fallbackKey - an item to wishlist would be to be able to do the opposite. That is option to disregard SimpleMessage (as it's already printed in the message field.) Another option could be to use the mapresolver without specifying key?

      If I understand the request right, making key directive optional (hence, one would be able to resolve the entire MapMessage) and adding a flatten directive (similar to the one in MDC resolver) can address this wish. That is,

      config        = [ key ] , [ stringified ] , [ flatten ]
      key           = "key" -> string
      stringified   = "stringified" -> boolean
      flatten       = "flatten" -> ( boolean | flattenConfig )
      flattenConfig = [ flattenPrefix ]
      flattenPrefix = "prefix" -> string
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vy Volkan Yazici
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: