Skip to content
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

SDK should not pull non-API logging dependencies #170

Open
grimsa opened this issue Jul 9, 2020 · 0 comments
Open

SDK should not pull non-API logging dependencies #170

grimsa opened this issue Jul 9, 2020 · 0 comments

Comments

@grimsa
Copy link

grimsa commented Jul 9, 2020

The following logging dependencies are present in the SDK library (version 2.0.2):

compile commons-logging:commons-logging:1.1.1
compile org.apache.logging.log4j:log4j-jcl:2.13.3
compile org.apache.logging.log4j:log4j-api:2.13.3
compile org.apache.logging.log4j:log4j-core:2.13.3
compile org.apache.logging.log4j:log4j-1.2-api:2.13.3

This is a problem because it imposes a specific logging setup (based on Log4j 2) on projects using the SDK.
However, the decision on how to set up the logging is that of the project using the SDK.

The proper way to handle this situation in SDK would be to:

  1. Have just one compile scope dependency on a logging API of your choice (it can be log4j-api, or commons-logging if choosing from existing ones; SLF4J 1.7.x is also a common choice).
  2. Have other logging dependencies with test scope, if you want logging to work in your test code

And then the project that is using the SDK can decide where to redirect the logging.

For example, let's say you choose Log4j 2 API as the one logging API for this SDK.
Let's say I also depend on another library that logs to SLF4J API and in my app for some reason I must use Log4j 1.2 as the logging implementation.
Then I can simply configure the required adapters and bridges (Log4j2 to SLF4J, SLF4J to Log4j 1.2), and not have to exclude a bunch of transitive dependencies I do not need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant