-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ConsoleAppender: Fix missing default Target value #3852
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
Conversation
Hi @rschmitt, Since the method you improved has been deprecated since version |
@ppkarwasz It absolutely needs fixing, this is a regression and it's breaking code that I'm trying to upgrade from 2.24.3. I don't know exactly what the relevant call path is or what changed in it, all I know is that I have a bunch of broken plugin code whose tests are failing because |
@ppkarwasz, while I do agree with you, the fix @rschmitt is proposing to the deprecated @rschmitt, how feasible is it for you to fix code paths accessing deprecated Log4j APIs? |
@vy I already have a variety of issues associated with 2.25 that I am working on fixing. For example, the JSpecify annotations added in commits like a1dfa85 are breaking JDK8 builds that are using Mockito to mock APIs with those annotations, because they don't have those annotations on their test classpath. (This appears to be a bug in core reflection. It works fine on JDK17.) Other builds are failing due to the combination of I haven't submitted issues or bug reports for any of these things, because they're not obviously regressions in Log4j itself, and I have to either fix the packages that can't upgrade or patch Log4j itself to work around the issue. This issue OTOH is clearly a regression, because the method doesn't do what the Javadoc says it should, and there's some sort of validation logic in 2.25 that is surfacing the problem. Since this is a bug, I'd rather fix it upstream than change all the consumers to use non-deprecated code paths, since that would just take time away from the issues I've listed in the previous paragraph, which I'm still working on. |
I am OK with the proposed patch, I was just wondering if we should also protect users that use |
I think the exception should happen on construction to allow for setters to be called over and over. |
Hi @rschmitt, Sorry to hear you've run into so many issues with the upgrade. Fortunately, we encountered all of these problems before and we’re happy to help.
This is a known issue caused by JDK-8152174. We also test on JDK 8 in our CI pipeline, and have documented the workaround here: logging-log4j2/log4j-parent/pom.xml Lines 1160 to 1171 in 286191e
Yes, we’ve run into this too. There’s a detailed discussion on the dev@logging mailing list here: A few key takeaways:
Yes, that should be documented in the release notes. Did we do it properly?
Thank you for not opening new issues. We had similar issue reports before, but we currently don’t have a clean long-term solution (short of bytecode manipulation to strip annotations). Suggestions are always welcome. |
I'm actually releasing Log4j 2.25.1 right now. I've fixed all the known issues pretty much along the lines you've described, such as adding test dependencies on
I suppose the long-term solution is to wait for the Valhalla technology, in this case null-restricted and nullable types. Until then, nullability can only be modeled using third-party annotations, and most dependency managers don't have a concept of transitive compile-only dependencies (what Gradle calls Personally, I don't believe in linters. I think they provide very marginal benefits at the cost of significantly more fragile and complex builds. This whole thing with the |
fe8f95c
to
cead8f4
Compare
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.
@rschmitt, would you mind adding a changelog entry, please?
@vy Will do, I just didn't realize that this change merited a changelog entry. |
I’m wondering about the best approach to maintain synchronization between @vy, what do you think about consistently performing one of these actions before merging any PR to
This approach would ensure we avoid accumulating backlog and helps us verify merges effectively. In this specific case, the change does not need porting because the modified method was already removed from |
That approach sounds good to me. It might be useful to add some labels to indicate whether a PR has been verified to be applied to all applicable branches (or the inverse: a label to indicate that a PR still needs to be verified as ported). |
I understand the motivation for keeping
|
What I am proposing here should not block development: it takes 5 minutes to open a new issue or mark that a PR is not applicable to I would love if you could cherry-pick the changes, but I am not doing it myself, so I would leave it as an option. |
Yes, please don't hold up fixing and/or releasing g from 2.x 👍 |
I'm not looking for a process blocker. I primarily want to keep track of todo items so they're not lost. The plan is to be more involved with 3.x maintenance, yes. |
Just out of curiosity, is Log4j 3 targeting any particular minimum Android version? Only extremely recent versions natively support classfile version 61.0, and older versions have limitations on what can be desugared to Java 6/7/8 bytecode. |
Let's give it a try. How are we gonna streamline it? |
If you want to streamline it, there is cherry-picker, but for me opening a small issue that just mentions which PR to port seems enough for now. |
Co-authored-by: Volkan Yazıcı <volkan.yazici@oracle.com>
This adds a trivial missing code path to implement the documented default value for
Target
.