Centralize initialization in `Provider` class
We move the code responsible for the instantiation of
`LoggerContextFactory` and `ThreadContextMap` from the static entry
points to the logging system (`LogManager` and `ThreadContext`) to the
`Provider` class.
The `Provider` class is instantiated using `ServiceLoader`, so
`log4j-core` 2.x and 3.x can reimplement the initialization process
according to their own rules. E.g. `log4j-core` 3.x can use the DI to
create an instance of `LoggerContextFactory` and `ThreadContextMap`.
The following modification were performed:
* a **new** system property `log4j.provider` was introduced,
* the old `log4j2.loggerContextFactory` has been deprecated and revised: if set it
selects the first provider that uses the given `LoggerContextFactory`.
Therefore it selects now both the context factory and thread context
map implementations,
* private static configuration values were removed from
`ThreadContextMap` implementations, helping test parallelisation,
* a distinct `NoOpThreadContextStack` implementation has been
introduced.
16 files changed