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

Variable substitution: ${sys:foo} defaults to <property name=":foo">, should default to <property name="foo">

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0-beta1
    • 2.0-beta3
    • Core
    • None

    Description

      The following configuration doesn't work (${sys:log.level} can't be resolved even though default value is provided).

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration status="OFF">
      <properties>
      <property name="log.level">error</property>
      <property name=":log.level">ACTUALLY_GETS_USED</property>
      </properties>
      <appenders>
      <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d

      {HH:mm:ss.SSS}

      [%t] %-5level %logger

      {36}

      - %msg%n"/>
      </Console>
      </appenders>
      <loggers>
      <root level="${sys:log.level}">
      <appender-ref ref="Console"/>
      </root>
      </loggers>
      </configuration>

      In org.apache.logging.log4j.core.lookup.Interpolator.lookup(LogEvent, String), on line 110,
      var = var.substring(prefixPos) should be var = var.substring(prefixPos + 1) instead.

      Attachments

        Activity

          People

            rgoers Ralph Goers
            dtreskunov Denis Treskunov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: