-
Notifications
You must be signed in to change notification settings - Fork 41.3k
Avoid using deprecated Log4j exception converter ctors #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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Volkan Yazıcı <[email protected]>
18f82d4
to
b14948b
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.
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 { |
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.
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 apublic static LogEventPatternConverter newInstance()
method, you could have both plugins return the same shared private implementation ofLogEventPatternConverter
, reducing duplication.
@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. |
...c/main/java/org/springframework/boot/logging/log4j2/WhitespaceThrowablePatternConverter.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Volkan Yazıcı <[email protected]>
Log4j
2.25.0
deprecatedThrowablePatternConverter
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.