Can I use SLF4J in a specific GlassFish application and configure SLF4J exclusively for that application? We are currently struggling with the fact that GlassFish GlassFish itself with Hibernate installed contains the SLF4J API and the registrar binding in its lib directory.
Our team is developing the Java EE 6 web application. For development, the application is deployed on GlassFish 3.1.2, it should be as portable as possible.
We decided to use SLF4J to register application messages. Depending on the message level, the application must process certain log messages differently and, therefore, should be able to independently configure the logging backend - as opposed to setting up logging on the application server.
Unfortunately, GlassFish 3.1.2 includes slf4j-api-1.5.8.jar and slf4j-jdk14-1.5.8.jar in its lib folder. This prevents our application from using slf4j-api-1.7.5.jar and slf4j-simple-1.7.5.jar (the latter will eventually be replaced by another binding).
Is there a way to tell GlassFish to consider the lib application before considering its own (so that the correct version of the API is used) and how could it be verified that the application provided the SLF4J binding?
We use Eclipse for development, but does not use Maven . Most of the tricks / workarounds I've found so far relate to a configuration in Maven that we cannot use. If you can provide any special Eclipse tips, that would be great. In the properties of the Eclipse project, I have already set up the build order so that the web application libraries are on top. But for some reason this is not enough.
Many thanks for your help!
Update 1: To make it work temporarily, I just deleted the SLF4J libraries from the GlassFish library directory. The application then uses its own SLF4J libraries. But I donβt think this is a solution for the deployment process, Iβm not sure that it can break anything used by GlassFish (why are the libraries there anyway?), And this is not a practical solution for our development team.
Update 2: Actually, this is not GlassFish, which includes the built-in SLF4J library out of the box, but the Hibernate JPA package that I installed using the update tool. We donβt need Hibernate JPA at present, but the requirement to migrate to Hibernate may arise at some point, and we would also like the application to be easily portable to application servers with Hibernate JPA or other packages containing SLF4J. I updated the question title accordingly. How can I solve this general problem of the interfering dependencies of the application server and applications?