-
Notifications
You must be signed in to change notification settings - Fork 623
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
why was slf4j-api added as a dependency? #1094
Comments
it was added because it's used in almost any library, and it lets the application control logging. You can check #802 |
yes,it is trouble for me to add external dependencies. look it... |
I must also raise a concern about this. JRuby does not ship with slf4j and we are very reluctant to add new dependencies. As a result, when we support SQLite for Ruby on Rails we will also have to ship an slf4j library. Most users of slf4j I know of allow their code to fall back on j.u.logging so that upstream users do not have to introduce a new dependency. This also conflicts with users running on other logging backends, forcing the use of two different logging frameworks for no good reason. Can we please reopen this discussion and figure out a way to remove the slf4j hard dependency from sqlite-jdbc? |
In #802 (comment) @gotson mentions that two other drivers also use slf4j: MySQL and H2. However on both of these databases, the slf4j usage and depedency is optional:
Both databases default to a simple logger without external dependencies. |
remove the slf4j1 dependency, as this causes conflicts between different versions (for example i can't use JDA which uses slf4j2) |
@gotson It seems like this hard slf4j dependency is still causing trouble for people. Can we please have a discussion about making it optional? As I pointed out in #1094 (comment), none of the databases you used as examples actually have a hard dependency on slf4j. The only option for users that want to avoid the dependency is to fork the project and push their own artifacts. Nobody wants to have to do that, especially me! |
i have made a fork, check my profile |
if someone can send a PR where SLF4J is a soft-dependency, with a fallback on JUL, i will have a look at it. |
@gotson Thank you for your flexibility! 🙇♂️ @KweezyCode You have commits that remove SLF4J altogether, do you want to take a stab at making it optional? We might be able to get this resolved quickly! |
I don't support the idea of bloating the software, so it's better to remove something from the library than to make something optional (which will make the code grow even more) |
i hope we can meet on middle ground. making it optional sounds like a reasonable way to solve this issue. |
@KweezyCode Optionally using slf4j has become pretty standard as a way to allow users to configure other kinds of loggers without the original author having to add support for them. It is in most cases the last logging framework you ever need to add, because it acts as a shim on top of all the other ones. This pattern is quite common and adds very little bloat. I think we also need to be pragmatic here. The two other database drivers mentioned both include slf4j as an optional logging backend and @gotson is meeting us halfway here by accepting a patch to make it optional in this driver. I for one just want to get this patched and released so my users can upgrade. |
Here is one serious problem I have hit today while upgrading to latest version: If you are running in a multi-classloader container like Tomcat and you have the JDBC driver in the server or common classloader to make it available to all webapps and the webapp uses SLF4J and its own SLF4J binding you will end with such a fuckup:
This is not funny and there is not way to solve. The only workaround is to move the JDBC driver into the webapp classloader. So adding SLF4J the way it is now wasn't good after all. I support @headius' position. I forgot to mention: The JAR installed has all native libraries stripped because they aren't suited. SQLite3 is globally installed, the JNI shim is linked against it and installed globally as well. No size overhead, no extraction overhead. Since it is a stripped-down version I cannot use the one from Maven Central as a dep in my webapp POM. The other one comes with a custom-tailed Tomcat. Loss-loss situation here. |
In order to avoid the hard dependency on slf4j, this patch abstracts the Logger interface and LoggerFactory factory to fall back on a java.util.logging-based implementation if slf4j is not present. Fixes xerial#1094
I have pushed #1178 which makes slf4j optional. It is no longer a hard dependency, and when not present the implementation will fall back on java.util.logging, similar to other JDBC drivers. I will work with the xerial/sqlite-jdbc maintainers to get that PR merged. Could this issue be reopened please? |
In order to avoid the hard dependency on slf4j, this patch abstracts the Logger interface and LoggerFactory factory to fall back on a java.util.logging-based implementation if slf4j is not present. Fixes xerial#1094
I think you should file a separate bug for this. |
this issue will remain closed, it was a question. The PR being opened is enough. |
In order to avoid the hard dependency on slf4j, this patch abstracts the Logger interface and LoggerFactory factory to fall back on a java.util.logging-based implementation if slf4j is not present. Fixes xerial#1094
In order to avoid the hard dependency on slf4j, this patch abstracts the Logger interface and LoggerFactory factory to fall back on a java.util.logging-based implementation if slf4j is not present. Fixes xerial#1094
In order to avoid the hard dependency on slf4j, this patch abstracts the Logger interface and LoggerFactory factory to fall back on a java.util.logging-based implementation if slf4j is not present. Fixes xerial#1094
Refs: #1094 Co-authored-by: Gauthier Roebroeck <gauthier.roebroeck@gmail.com>
#1178 was merged! We just need a release now. |
thanks for everybody who helped solve this. |
🎉 This issue has been resolved in |
Thank you for the release! |
i read: #997 (comment)
and: 32082c0
and: 89dbda1
but i can not see any reason this was done.
here it says "Read the Changelog", but there is nothing about slf4j-api in the changelog.
why was this added? can you link to documentation about the decision or some code in sqlite that requires it?
why was it not possible to make this optional?
The text was updated successfully, but these errors were encountered: