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

Classpath polution with slf4j-simple dependency in moco-core #99

Closed
szpak opened this issue Nov 12, 2014 · 4 comments
Closed

Classpath polution with slf4j-simple dependency in moco-core #99

szpak opened this issue Nov 12, 2014 · 4 comments

Comments

@szpak
Copy link

szpak commented Nov 12, 2014

moco-core depends on slf4j-simple which generates problems.

It is the responsibility of the end project to provide slf4j implementation (usually slf4j-logback or slf4j-log4j) even in tests. When multiple slf4j implementations (bindings) are on a classpath slf4j isn't happy and emits warning.
Maven/Gradle doesn't treat they (slf4j-logback and slf4j-simple) as the same library as they have different names and that is correct. It is required to manually exclude slf4j-simple in a build configuration.

Summarizing IMHO there is no need to have slf4j-simple declared as moco-core dependency.

@dreamhead
Copy link
Owner

Good suggestion. I tend to remove this dependency but I have to consider the scenario which user don't have any implementation for slf4j. Do you have any further suggestion for that?

@bbaron
Copy link

bbaron commented Nov 13, 2014

If the downstream project isn't using the slf4j-api, slf4j provides bridge modules that will route slf4j calls to the actual logging framework. This page http://www.slf4j.org/legacy.html describes scenarios for bridging calls between slf4j and other loggers. That will allow slf4j logging calls in the moco code to be forwarded to commons-logging, log4j, java util or other logger.

@szpak
Copy link
Author

szpak commented Nov 13, 2014

@dreamhead When Slf4j detects no bindings on a classpath it generates warning on a console with the information where they could be found. Developer seeing that would need to add it as explicit dependency (he/she could choose slf4j-simple) when appropriate to have messages from moco logged.

@dreamhead
Copy link
Owner

Thanks all. I've already remove slf4j-simple from core. You can build your own Moco until next Moco releases.

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

3 participants