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

Remove need to pre-specify appender et al. identifiers in property file config format

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4, 2.5
    • 2.6
    • Configurators
    • None

    Description

      In the .properties config file format, several plugin types currently require you to declare names ahead of time. For instance:

      status = ERROR
      
      filters = Threshold
      
      filter.Threshold.type = ThresholdFilter
      filter.Threshold.level = DEBUG
      
      appenders = Stdout
      
      appender.Stdout.type = Console
      appender.Stdout.name = StdOut
      appender.Stdout.target = SYSTEM_OUT
      appender.Stdout.layout.type = PatternLayout
      appender.Stdout.layout.pattern = %d [%t] %-5level: %msg%n%throwable
      appender.Stdout.filters = marker
      appender.Stdout.filter.marker.type = MarkerFilter
      appender.Stdout.filter.marker.onMatch = DENY
      appender.Stdout.filter.marker.onMisMatch = NEUTRAL
      appender.Stdout.filter.marker.marker = FLOW
      
      loggers = log4j
      
      logger.log4j.name = org.apache.logging.log4j
      logger.log4j.appenderRefs = console
      logger.log4j.appenderRef.console.ref = StdOut
      logger.log4j.level = DEBUG
      logger.log4j.additivity = false
      
      rootLogger.appenderRefs = console
      rootLogger.appenderRef.console.ref = StdOut
      rootLogger.level = ERROR
      

      would be transformed into

      status = ERROR
      
      filter.Threshold.type = ThresholdFilter
      filter.Threshold.level = DEBUG
      
      appender.Stdout.type = Console
      appender.Stdout.name = StdOut
      appender.Stdout.target = SYSTEM_OUT
      appender.Stdout.layout.type = PatternLayout
      appender.Stdout.layout.pattern = %d [%t] %-5level: %msg%n%throwable
      appender.Stdout.filter.marker.type = MarkerFilter
      appender.Stdout.filter.marker.onMatch = DENY
      appender.Stdout.filter.marker.onMisMatch = NEUTRAL
      appender.Stdout.filter.marker.marker = FLOW
      
      logger.log4j.name = org.apache.logging.log4j
      logger.log4j.appenderRef.console.ref = StdOut
      logger.log4j.level = DEBUG
      logger.log4j.additivity = false
      
      rootLogger.appenderRef.console.ref = StdOut
      rootLogger.level = ERROR
      

      These names should be inferable by their first usage. Then the appenders, filters, loggers, etc., properties can all be safely ignored for backwards compatibility with 2.4/2.5.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mattsicker Matt Sicker
            mattsicker Matt Sicker
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment