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

Remove (or document) slf4j dependency #11

Closed
andytill opened this issue Jul 8, 2012 · 3 comments
Closed

Remove (or document) slf4j dependency #11

andytill opened this issue Jul 8, 2012 · 3 comments
Assignees
Milestone

Comments

@andytill
Copy link

andytill commented Jul 8, 2012

I am not using Maven, so after adding the core-0.1.7.jar dependency manually, the exception below was thrown. After adding the the slf4j simple and api jars it worked as expected.

Is it absolutely necessary to have the slf4j dependency? I would rather not have a library log anything at all unless I configured it to do so.

I really appreciate the work you have put into this, it would be great if FXForm2 could work straight out of the box for us non Maven users.

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at com.dooapp.fxform.FXForm.<clinit>(FXForm.java:48)
........
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 54 more
@amischler
Copy link
Member

Thanks for pointing this out, I'll update the documentation.
Initially, we took the decision to use the sl4j library since it's a logger abstraction layer and you are free to choose the implementation you need; but you are right, it's quiet annoying to have to add manually two dependencies only for logging when not using maven.
I remember that such a discussion took place in the jfxtras-dev mailing list and I think they ended up removing the sl4j dependency and just using the jdk loggers.
Any ideas about another solution?

@ghost ghost assigned amischler Jul 9, 2012
@andytill
Copy link
Author

andytill commented Jul 9, 2012

Is the information that is being logged important enough that the library user needs to be aware of it, but not important enough to throw an exception?

For example, at the moment I haven't defined any CSS or resources for the form I am generating which causes a warning to be logged, even though the form style is OK for my needs at the moment.

Maybe a fail fast approach to errors with really good exception messages would be better, instead of writing warning logs and carrying on. If most of these exceptions occur when the form is being generated then the developer would have to fix them either way.

Using the JDK logging library is preferable if logging must be used. The only other method I can think of is to define an adapter interface which the library can use and users can implement for their own logging library. You would only need to implement #isWarnEnabled and #warn since everything else would be an exception.

Cheers

@amischler
Copy link
Member

Documentation updated: https://github.com/dooApp/FXForm2/wiki/Add-FXForm2-to-your-project-dependencies

Thanks for your feedback. We will consider removing the slf4j dependency in a future release.

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

2 participants