Thursday, 3 October 2013

Log files separation, SLF4J in tomcat endorsed folder with different bindings

Log files separation, SLF4J in tomcat endorsed folder with different bindings

Given that I have a Tomcat and I have no in depth control on it, which has
for some reasons the SLF4J library with the JDK binding in the endorsed
folder.
Is there a way I can deploy my web application, which is using some
framework (such as hibernate) where I cannot explicitely set the slf4j
binding to logback as I am doing in my code, to log into my web-app
private logging context instead of using the one provided by the previous
binding?
Currently my result is that I have my application code logging correctly
to my log file, but all the other frameworks like hibernate logging on the
catalina.out, which is due to the slf4j binding found in the endorsed.
P.S. I tried also setting in my context class loader my custom
StaticLoggerBinder in order to provide the correct implementation, but it
was not being taken into consideration.