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

Add Log4j API to JUL bridge #3

Merged
merged 65 commits into from
Dec 23, 2024
Merged

Add Log4j API to JUL bridge #3

merged 65 commits into from
Dec 23, 2024

Conversation

ppkarwasz
Copy link
Contributor

This add a new log4j-api-to-jul bridge based on log4j-to-jul from the 2.x branch of Log4j.

rgoers and others added 30 commits November 6, 2024 13:02
The original 15 was blindly copied from SLF4JProvider.

It's probably better to not have them be the same, and have To-JUL's higher than SLF4j's (which in turn is higher than Core's 10).
These tests provide additional coverage in the event parameters
are passed through, demonstrating how JUL formatters are likely
to misinterpret such LogRecords.
- Remove invalid <relativePath> values
- Disable doap and changes plugins in child modules
- Use correct Fragment-Host in bundles implementing log4j-core plugins
- Add OSGi service loader metadata for more bundles
Switches `log4j-to-slf4j` and `log4j-to-jul` from using the Service
Loader Mediator to registering their provider themselves. This way they
can be used in minimal OSGI systems.

Newer tests in `log4j-osgi` are written using PAX Exam in order to
provide a larger OSGI environment.
`LogManager.getGlobal().getLevel()` is not a good fallback for the case
when all JUL logger levels are null, since its level is usually null.
This replaces independent JUnit5 dependency versioning with a single
`junit-bom` dependency.
This removes the scope of the dependencies from <dependencyManagement>
and adds it to the children POMs.

The reason behind this is that we don't want to force the scope of
transitive dependencies: e.g. `log4j-api` has a `javax.inject`
transitive test dependency. If we set the scope to `provided` in the
parent POM, the test dependency becomes a provided dependency.
Improves the `src/tools/sort-pom.xslt` stylesheet to sort dependencies in the
POM files according to the scope, artifact id (with a priority for Logj2
artifacts) and group id.

It uses this script to automatically sort all POM files.
This PR removes all explicitly versioned plugins that are also defined in the
Apache ASF parent POM (`org.apache:apache`).

This has the following effect on plugin versions:

 * `maven-assembly-plugin` bumped to 3.4.1
 * `maven-jar-plugin` bumped to 3.2.2
 * `maven-javadoc-plugin` bumped to 3.4.0
 * `maven-project-info-reports-plugin` bumped to 3.3.0
 * `maven-release-plugin` bumped to 3.0.0-M6
 * `maven-scm-plugin` bumped to 1.13.0
 * `maven-site-plugin` bumped to 3.12.0
The versions of all used plugins are specified in the `log4j` parent POM
or other parent POMs (`log4j-bom`, `log4j-samples`,
`log4j-spring-cloud-config` or `log4j-spring-cloud-config-samples`).

The script `src/tools/explicit-version.xslt` can be used to check for
explicitly provided version.
The 'default' maven-remote-resources-plugin execution is a no-op,
because the ASF parent uses a different id.
- Removed `maven-jxr-plugin`
- Generating no Javadoc JARs (this was already the case)
- Removed Javadoc JARs from the assembly in `log4j-distribution`
- Generating Javadoc HTML only for `log4j-core` and `log4j-api`
- Copying generated Javadoc HTML to `target/site/javadoc/<artifactId>`
rgoers and others added 26 commits November 6, 2024 13:02
This also runs `spotless:apply` on the modified files.
- `/pom.xml` is moved to `/log4j-parent/pom.xml`
- `/log4j-bom/pom.xml` is moved to `/pom.xml`
- Implements the BOM organization described by Maven[1].
  That is, `parent` inherits from `bom`.
- Takes advantage of `flatten-bom` provided by `logging-parent`
- Identical scheme to the one found in `-tools` and `-transformation`

[1] https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms
There are many modules that do not depend on `log4j-core` and they can
be easily built without it on the processor path.
Since the split between modules that have Log4j Core plugins and those
that don't is about 50/50, it is more proper to add `log4j-core` to some
modules instead of removing it from others (and copy/paste all other
options).
In order to prevent API breaking changes, this:
 * adds [`bnd-baseline-maven-plugin`](https://github.com/bndtools/bnd/tree/master/maven-plugins/bnd-baseline-maven-plugin),
 * fix the API changes that would require a major version bump,
 * set the OSGi version of each packages to `2.20.1` or `2.21.0`,
   depending on the kind of changes the package underwent since the
   `2.20.0` release.
Signed-off-by: Matt Sicker <mattsicker@apache.org>
By removing the reflective instantiation of `LoggerContextFactory` and
`ThreadContextMap`, we make `log4j-to-jul` and `log4j-to-slf4j` more
GraalVM-friendly.
- Make `StringArray` the default thread context map
- Remove `CopyOnWriteSortedArrayThreadContextMap`
- Move `GarbageFreeSortedArrayThreadContextMap` to `log4j-core`
This adds a Groovy script that fails the build
if any optional JPMS module has the `transitive` qualifier.

We remove the `transitive` modifier from all optional dependencies.

Closes #2929.

Co-authored-by: Volkan Yazıcı <volkan@yazi.ci>
Co-authored-by: Piotr P. Karwasz <piotr.github@karwasz.org>
@ppkarwasz ppkarwasz marked this pull request as ready for review December 23, 2024 08:16
@ppkarwasz ppkarwasz merged commit 9530a3e into main Dec 23, 2024
6 checks passed
@ppkarwasz ppkarwasz deleted the feature/log4j-api-to-jul branch December 23, 2024 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants