Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Avoid using deprecated Log4j exception converter constructors #46372

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

Open
vy wants to merge 2 commits into spring-projects:main
base: main
Choose a base branch
Loading
from vy:log4j2-converters-composition

Conversation

vy
Copy link
Contributor

@vy vy commented Jul 9, 2025

Log4j 2.25.0 deprecated ThrowablePatternConverter ctors, where they are employed in Spring Boot's [Extended]WhitespaceThrowablePatternConverter – see apache/logging-log4j2#3809. This PR amends these classes to avoid using deprecated ctors.

Signed-off-by: Volkan Yazıcı <volkan@yazi.ci>
@vy vy force-pushed the log4j2-converters-composition branch from 18f82d4 to b14948b Compare July 9, 2025 18:58
Copy link
Contributor

@ppkarwasz ppkarwasz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, although the implementation could be further simplified.

@@ -34,24 +35,32 @@
*/
@Plugin(name = "ExtendedWhitespaceThrowablePatternConverter", category = PatternConverter.CATEGORY)
@ConverterKeys({ "xwEx", "xwThrowable", "xwException" })
public final class ExtendedWhitespaceThrowablePatternConverter extends ThrowablePatternConverter {
public final class ExtendedWhitespaceThrowablePatternConverter extends LogEventPatternConverter {
Copy link
Contributor

@ppkarwasz ppkarwasz Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit-pick: Since ExtendedWhitespaceThrowablePatternConverter and WhitespaceThrowablePatternConverter differ only in the specific LogEventPatternConverter they delegate to, the implementation can be simplified by:

  • Having one implemented in terms of the other, or
  • Taking advantage of the fact that pattern converters don’t need to directly implement LogEventPatternConverter, but only provide a public static LogEventPatternConverter newInstance() method, you could have both plugins return the same shared private implementation of LogEventPatternConverter, reducing duplication.

@vy
Copy link
Contributor Author

vy commented Jul 9, 2025

@snicoll, please let us know how you want to proceed with. I've tried to keep the changes minimal, though I can implement the improvements suggested by @ppkarwasz, if it is of your liking.

@snicoll snicoll added the for: team-attention An issue we'd like other members of the team to review label Jul 10, 2025
Signed-off-by: Volkan Yazıcı <volkan@yazi.ci>
@philwebb philwebb added type: task A general task and removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged labels Jul 23, 2025
@philwebb philwebb added this to the 4.0.x milestone Jul 23, 2025
snicoll pushed a commit that referenced this pull request Aug 21, 2025
See gh-46372
Signed-off-by: Volkan Yazıcı <volkan@yazi.ci>
@snicoll snicoll changed the title (削除) Avoid using deprecated Log4j exception converter ctors (削除ここまで) (追記) Avoid using deprecated Log4j exception converter constructors (追記ここまで) Aug 21, 2025
@snicoll snicoll self-assigned this Aug 21, 2025
@snicoll snicoll modified the milestones: 4.0.x, 4.0.0-M2 Aug 21, 2025
Copy link
Member

Unfortunately, we need to revert this for now due to apache/logging-log4j2#3893 as warnings caused by the undefined property break our verification tests.

wilkinsona added a commit that referenced this pull request Aug 21, 2025
@philwebb philwebb modified the milestones: 4.0.0-M2, 4.0.x Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@wilkinsona wilkinsona wilkinsona left review comments

+1 more reviewer

@ppkarwasz ppkarwasz ppkarwasz left review comments

Reviewers whose approvals may not affect merge requirements
Labels
type: task A general task
Projects
None yet
Milestone
4.0.x
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /