Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centralize initialization in Provider class #2374

Merged
merged 4 commits into from
Mar 21, 2024
Merged

Commits on Mar 21, 2024

  1. 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.
    ppkarwasz committed Mar 21, 2024
    Configuration menu
    Copy the full SHA
    cad5b9e View commit details
    Browse the repository at this point in the history
  2. Changelog entry for PR #2374

    ppkarwasz committed Mar 21, 2024
    Configuration menu
    Copy the full SHA
    165f71c View commit details
    Browse the repository at this point in the history
  3. Fix Javadoc generation

    ppkarwasz committed Mar 21, 2024
    Configuration menu
    Copy the full SHA
    760bafa View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3cfb7b5 View commit details
    Browse the repository at this point in the history