-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Ensure Spring LogFactory
contains all public methods from Apache LogFactory
#30668
Ensure Spring LogFactory
contains all public methods from Apache LogFactory
#30668
Conversation
…he LogFactory to avoid NoSuchMethodErrors when such a method is called.
@maartenc Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@maartenc Thank you for signing the Contributor License Agreement! |
NoSuchMethodError
: org.apache.commons.logging.LogFactory.setAttribute(..)
NoSuchMethodError
: org.apache.commons.logging.LogFactory.setAttribute(..)LogFactory
contains all public methods from Apache LogFactory
@maartenc this pull request looks good for a start, thanks for raising it! I didn't expect those attribute methods to be called for non-service usage but we can certainly declare them on the regular However, my preference would be for a minimal no-op implementation on the core Would this work for your purposes? If you'd like to update the PR accordingly, please rebase it onto the |
Hi @jhoeller , thanks for the review! Regarding the rebase to the |
No worries about the target branch, I can also merge this into (In general, changing the target branch can e.g. be done on GitHub through the "Edit" button and then a dropdown box for the branch name, but preferably rebasing locally first and then force-pushing the rebased commit to the PR. Since we are going to squash your three commits into one anyway, it won't make much difference here, so no need to spend a lot of time with it.) |
Thanks for your follow-up @jhoeller ! |
Hi,
we encountered a similar issue as #21835, but a bit different use-case.
The fix for #21835 was not sufficient for this situation.
Our Spring application uses other libraries that have constructs like the snippet below.
These libraries were compiled against the original Apache Commons Logging API.
If we use this class in our Spring application (which includes
spring-jcl
), we encounter the following error when theFoo
class gets loaded:The reason for this error is that the Spring-version of the
LogFactory
class does not specify thissetAttribute(...)
method, which results in this NoSuchMethodError when some code tries to call it.I've created a pull request which I believe will solve the issue.
This PR adds all missing public methods to the Spring
LogFactory
class. To maximize code re-use, I've extracted the existing 'attribute-logic' fromLogFactoryService
into a new class (LogFactoryImpl
).Maarten