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

Property substitution not working if <Properties> tag is not placed at the beginning of configuration

    XMLWordPrintableJSON

Details

    • Documentation
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.11.1
    • 2.11.2
    • Core
    • Any project with log4j using as configuration a file like the one attached as example.

      With this configuration, logs will be printed as ${defaultLayout} instead of the actual message.

    Description

      Tweaking my log configuration I found out that if the <Properties> is not placed at the beginning of the config just after the <Configuration> tag, the property substitution is not performed at all.

      Looking at the documentation I haven't seen anything related to the ordering of the elements in the config files. If there's a good reason that the properties should be placed first place in configuration, it'd be a good idea to note it somewhere in the documentation.

      Attachments

        1. log4j2.xml
          0.4 kB
          Javier Armendáriz

        Activity

          People

            Unassigned Unassigned
            jarmendariz Javier Armendáriz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: