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

Multiple PropertySources with identical priority cannot be added to PropertiesUtil Environment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.17.2
    • 2.24.0
    • Core
    • None

    Description

      The org.apache.logging.log4j.util.PropertiesUtil.Environment maintains a set of sources by using a ConcurrentSkipListSet backed with a PropertySource.Comparator.

      Somewhat surprisingly, the ConcurrentSkipListSet will not add an item if comparing it to an existing one returns 0. This means that all PropertySource implementations must have unique getPriority() results. I think this might be better to use a Set that uses equals/hashCode to determine if items can be added and only use the Comparator for sorting.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pwebb Phillip Webb
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: