Skip to content

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

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 added a commit that referenced this pull request Aug 21, 2025
@snicoll snicoll closed this in 7a5e77f Aug 21, 2025
@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
@wilkinsona wilkinsona reopened this Aug 21, 2025
@wilkinsona
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
Labels
type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants