My preference would be the *lowest-value-comes-first* strategy for the
following reasons:

   - Natural ordering in Java (e.g., `Stream#sorted()`) yields the same
   result
   - This is how it works for Spring's `@Order` annotation

I would appreciate it if you can align javadoc and manual with this PR too.

Mind explaining what do you mean by *"the provider's priority uses the
highest-value-wins strategy"*, please?

*[Sorry for the late response Piotr. I was off for a week and trying to
catch up. BTW, I can't be happier that you have spotted these ordering
issues and addressed them swiftly. Keep up the great job! 💯]*


On Thu, Mar 10, 2022 at 7:36 AM Piotr P. Karwasz <piotr.karw...@gmail.com>
wrote:

> Hello,
>
> Among the problems I found in the ordering of property sources[1],
> there is the question of the meaning of the numeric priority value:
>
> * the manual says that lower numeric values override higher values[2],
> * the Javadoc suggests an inverted order[3].
>
> Which one should be the correct one? At first I implemented the
> documentation order[4], since users might have learned that one
> (although this order never worked, the first JIRA issue reporting it
> is from last December). However this leaves a bitter aftertaste,
> because the provider's priority uses the "highest value wins"
> strategy.
>
> I rebased my PR [4] (taking LOG4J2-3413 into account in the tests) and
> I am planning to merge it in the weekend.
>
> Piotr
>
> [1] https://issues.apache.org/jira/browse/LOG4J2-3366
> [2]
> https://logging.apache.org/log4j/2.x/manual/configuration.html#SystemProperties
> [3]
> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/util/PropertySource.html#getPriority--
> [4] https://github.com/apache/logging-log4j2/pull/742
>

Reply via email to