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

Remove Log4j2 entries from netty-common's reflection metadata #108

Merged
merged 1 commit into from
Nov 16, 2022

Conversation

wilkinsona
Copy link
Contributor

What does this PR do?

Apache Log4j2 does not work in a native image and that will be the case until Log4j2 3.0 at the earliest. Furthermore, Netty's InternalLoggerFactory is written such that SLF4J is preferred. As such, it does not make sense for Netty to provide reflection metadata for Log4j2 – in must cases the code that tries to use Log4j2 won't be reached and when it is, Log4j2 will not be usable anyway.

In addition to the reflection metadata for Log4j2 not being beneficial to Netty, it's also harmful when using JBoss Logging. The metadata is sufficient for JBoss Logging's attempt to use Log4j2 to reach the point where error-level logging of stack traces is performed before falling back to another logging framework. Without Netty's metadata for Log4j2, this fallback is performed silently as intended.

To address these problems, this PR removes the Apache Log4j2 entries from netty-common's reflection metadata.

Checklist before merging

  • I have properly formatted metadata files (see CONTRIBUTING document)
  • I have added thorough tests. (see this)

I haven't added any new tests but the existing tests continue to pass with the reduced metadata.

Apache Log4j2 does not work in a native image and that will be the
case until Log4j2 3.0 at the earliest [1]. Furthermore, Netty's
InternalLoggerFactory is written such that SLF4J is preferred. As
such, it does not make sense for Netty to provide reflection
metadata for Log4j2 – in must cases the code that tries to use
Log4j2 won't be reached and when it is, Log4j2 will not be usable
anyway.

In addition to the reflection metadata for Log4j2 not being
beneficial to Netty, it's also harmful when using JBoss Logging. The
metadata is sufficient for JBoss Logging's attempt to use Log4j2 to
reach the point where error-level logging of stack traces is
performed before falling back to another logging framework. Without
Netty's metadata for Log4j2, this fallback is performed silently as
intended.

[1] https://issues.apache.org/jira/browse/LOG4J2-2649
@dnestoro dnestoro merged commit d7ea99b into oracle:master Nov 16, 2022
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.

2 participants