-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Feature/2.x/enumerating and exposing named patters #3789
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
base: 2.x
Are you sure you want to change the base?
Feature/2.x/enumerating and exposing named patters #3789
Conversation
Signed-off-by: Roy Ash <[email protected]>
Signed-off-by: Roy Ash <[email protected]>
Signed-off-by: Roy Ash <[email protected]>
Signed-off-by: Roy Ash <[email protected]>
Signed-off-by: Roy Ash <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ashr123,
Thanks for the PR!
From my perspective, this refactoring does improve the readability of the decodeNamedPattern
method—cleaner logic and better structure are always welcome. That said, readability can be subjective, so I'd also like to hear what @vy (the original author) thinks about the change.
Regarding the visibility of the new NamedPattern
enum: as I mentioned in #3788 (reply in thread):
I'm not sure there's a strong case for making such an
enum
public. Unless there's a clear user-facing need, we prefer to keep our API surface area minimal.
Would it be possible to make the NamedPattern
enum package-private? Or would that conflict with the purpose of your change?
Currently, the PR triggers an API compatibility check failure:
[ERROR] Name Type Delta New Old Suggest If Prov.
[ERROR] * org.apache.logging.log4j.core.pattern PACKAGE MINOR 2.24.1 2.24.1 2.25.0 -
[ERROR] MINOR PACKAGE org.apache.logging.log4j.core.pattern
[ERROR] ADDED ENUM org.apache.logging.log4j.core.pattern.NamedPattern
This is caused by our BND Baseline mechanism, which flags any additions to the public API. If you do intend to make NamedPattern
public, you'll need to update the @Version
annotation in the package-info.java
file for the org.apache.logging.log4j.core.pattern
package. If not, making the enum package-private would avoid triggering this check.
Looking forward to your thoughts!
@ppkarwasz I see…
I'm also curious to find out what @vy thinks about it and I'll do whatever you decide |
I've created an enum for named patterns, that way I think it will be easier to maintain.
In addition the enum modifier is
public
because it lets users to reuse those patterns in there applicationChecklist
Before we can review and merge your changes, please go through the checklist below. If you're still working on some items, feel free to submit your pull request as a draft—our CI will help guide you through the remaining steps.
✅ Required checks
License: I confirm that my changes are submitted under the Apache License, Version 2.0.
Commit signatures: All commits are signed and verifiable. (See GitHub Docs on Commit Signature Verification).
Code formatting: The code is formatted according to the project’s style guide.
How to check and fix formatting
./mvnw spotless:check
./mvnw spotless:apply
See the build instructions for details.
Build & Test: I verified that the project builds and all unit tests pass.
How to build the project
Run:
./mvnw verify
I got the following error:
🧪 Tests (select one)
📝 Changelog (select one)
src/changelog/.2.x.x
. (See Changelog Entry File Guide).