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

Fix order of property sources

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.10.0
    • 2.18.0
    • None
    • None

    Description

      The current order of system property sources (cf. documentation) is rather unnatural, because:

      1. It gives a higher priority to environment variables than Java system properties. Java system properties apply to a single JVM, whereas environment variables might be shared between processes.
      2. It mixes up property sources accessible to system administrators and those accessible only to programmers (`log4j2.component.properties`).

      IMHO Log4j should prioritize the sources accessible to system administrators over `log4j2.component.properties`, hence allowing them to easily override the defaults established by developers. It should also prioritize Java system properties over environment variables. This is what, e.g. Spring Boot does. I propose the following order:

      1. System properties,
      2. Environment variables,
      3. `log4j2.component.properties` as failover.

      While technically this would be a breaking change, the official property source order never worked and bug LOG4J2-3193 was filed only recently. This proves that almost no one configures the same property in more than one source.

      Attachments

        Issue Links

          Activity

            People

              pkarwasz Piotr Karwasz
              pkarwasz Piotr Karwasz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: