-
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
Avoid Commons Logging API for using LoggingCacheErrorHandler with a custom logger #28678
Avoid Commons Logging API for using LoggingCacheErrorHandler with a custom logger #28678
Conversation
Could you consider this change for 6.0? I'd like to be able to set up Thanks. |
Good point, we seem to have missed that part the first time around in the 5.3.22 revision. I don't see a real need to deprecate the existing constructor (since we allow direct Drafting this locally, it is straightforward enough for a backport to 5.3.24, so I'm inclined to commit it there and repurpose this ticket for that addition to 5.3.x? Otherwise I can also create a separate GitHub issue for it. |
Thanks for the feedback Juergen. Not deprecating the constructor that accepts I can update the PR to remove the deprecation if that's your preference, and add some tests that use the new constructor. |
@vpavic If you could remove the deprecation and ideally rebase the PR onto 5.3.x (with a |
At present, creating LoggingCacheErrorHandler with custom logger requires use of Commons Logging API, as the appropriate constructor expects org.apache.commons.logging.Log instance. As Commons Logging is rarely the logging framework of choice in applications these days, interaction with its API might not be desirable. This commit adds LoggingCacheErrorHandler constructor that accepts logger name and thus avoids leaking out any details about the underlying logging framework.
aceea82
to
fa8e2e9
Compare
That is done now. I also added a simple test just for the sake of having something in the codebase that uses the newly introduced constructor. |
Thanks, that was quick :-) |
At present, creating
LoggingCacheErrorHandler
with custom logger requires use of Commons Logging API, as the appropriate constructor expectsorg.apache.commons.logging.Log
instance. As Commons Logging is rarely the logging framework of choice in applications these days, interaction with its API might not be desirable.This commit adds
LoggingCacheErrorHandler
constructor that accepts logger name and thus avoids leaking out any details about the underlying logging framework, while also deprecating the existing constructor that acceptsorg.apache.commons.logging.Log
.I'm opening this PR to discuss one aspect of #28648 that was overlooked as that PR was superseded:
These days, it's almost inevitable to have several logging frameworks on the classpath, with only one of those being the intended application-wide logging API. To avoid unintended use of other logging APIs, something like Checkstyle can be used to prohibit imports of undesirable classes. However,
LoggingCacheErrorHandler
makes this a bit difficult at the moment hence this proposal.If you agree this proposal and also with the deprecation of constructor that uses
org.apache.commons.logging.Log
, I'll rework the tests to avoid use of deprecated constructor.