-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Update LogAdapter to allow build-time code removal
#29506
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
Allow for example to remove those classes and 90 related methods when Logback is used: - org.apache.commons.logging.LogAdapter$JavaUtilAdapter - org.apache.commons.logging.LogAdapter$JavaUtilLog - org.apache.commons.logging.LogAdapter$LocationResolvingLogRecord - org.apache.commons.logging.LogAdapter$Log4jAdapter - org.apache.commons.logging.LogAdapter$Log4jLog - org.apache.commons.logging.LogAdapter$LogApi - org.apache.logging.log4j.message.ObjectMessage - org.apache.logging.log4j.message.ReusableObjectMessage - org.apache.logging.log4j.simple.SimpleLoggerContext - org.apache.logging.log4j.simple.SimpleLoggerContextFactory
jhoeller
left a comment
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, also the use of Function there instead of the enum-based delegation arrangement.
|
This change has broken the Spring Boot build. The error is currently hard to reproduce locally, but the stacktrace is: |
|
I think it's |
|
I think this is now fixed, sorry for the regression, this one was pretty hard to anticipate. I think previously this potential bug was possible but hidden by the fact the classpath checks were done lazily in the static block. Thanks for catching this with Boot tests. |
Allow for example to remove those classes and 90 related methods when Logback is used:
org.apache.commons.logging.LogAdapter$JavaUtilAdapterorg.apache.commons.logging.LogAdapter$JavaUtilLogorg.apache.commons.logging.LogAdapter$LocationResolvingLogRecordorg.apache.commons.logging.LogAdapter$Log4jAdapterorg.apache.commons.logging.LogAdapter$Log4jLogorg.apache.commons.logging.LogAdapter$LogApiorg.apache.logging.log4j.message.ObjectMessageorg.apache.logging.log4j.message.ReusableObjectMessage org.apache.logging.log4j.simple.SimpleLoggerContextorg.apache.logging.log4j.simple.SimpleLoggerContextFactoryorg.apache.logging.slf4j.SLF4JProviderextendsorg.apache.logging.log4j.spi.Provider, so a bunch of Log4j classes are still reachable, but looks like a useful improvement.