Search code examples
glassfish-3slf4jlogback

Glassfish3 deployment options for third party libraries


We deploy multiple web applications on glassfish 3.1.x application server. I would like to separate out third party libraries out of the individual war files and add them to a common location so that the deployment time is reduced. As a additional advantage the disk space is also reduced.

I tried adding the libraries in the domain/lib directory. The only issue I face is logging. We use slf4j and logback for application logging (some of the third party libraries also use the same). Since the libraries are in domain/lib while the configuration files (logback.xml) are in individual war files, logback does not find them and start logging in default mode (debug) for all packages.

How can I configure my applications such that the third party libraries are placed at a central location in glassfish and the logging is done as per the configuration files (logback.xml) from the individual web applications?


Solution

  • The logback manual has a chapter on logging separation which you might find pertinent. With the techniques described in that document, in particular ContextJNDISelector, you can achieve logging configuration per application.