Problem with Lucee 5.3.6.61 relating to SLF4j

I’m having an issue getting some SLF4j logging working on some third party Java libraries we’re using. The libraries are imported using {{this.javaSettings}}, but the libraries insist on using the org.slf4j.helpers.NOPLogger binding, which indicates it’s using the lucee-server/bundles/slf4j.nop-1.7.12.jar binder.

This is working correctly in ACF, because my folder containing the libraries has the slf4j-log4j12-1.7.12.jar binder and then I use the log4j.properties file to configure the logging.

However, because of the way the classloading works, it grabs SLF4j from the lucee-server/bundles/ JARs, so the slf4j-log4j12 binder is ignored.

I tried deleting the slf4j.nop-1.7.12.jar file, but the file is added automatically when Tomcat is restarted.

Anyone have any thoughts on how I might solve this issue?

I’ve been trying to find a way to switch the binding during runtime, but I’m not having any log.

The only solution I was able to come up with was to use the JavaLoader.cfc component instead of using the Application.cfc’s javaSettings feature.

I’m generally trying to move away from JavaLoader wherever possible in favour of dynamic OSGi loading: https://blog.simplicityweb.co.uk/121/loading-java-libraries-dynamically-in-lucee-without-javaloader

I’m not familiar with SLF4j, but slf4j.nop-1.7.12.jar appears to be OSGi friendly (i.e. it has the required meta-data in its manifest).