Use SLF4J with GlassFish 6.2.2 server on JDK11

Viewed 79

I just tried to get GlassFish 6.2.2 server on JDK11 to work with SLF4J. With GlassFish versions <=6.0.0 on JDK 8 I always used the instructions by Harald Wellmann to install SLF4J.

One step from the instructions is to copy SLF4J and logback libraries to the <glassfish-directory>/lib/endorsed directory.

But JDK11 seems to not support endoresed libraries anymore. Even if I copy the files to <glassfish-directory>/lib or <glassfish-directory>/domains/domain1/lib, they are not found.

java.lang.ClassNotFoundException: org.slf4j.bridge.SLF4JBridgeHandler

Harald Wellmann wrote on his blog that

the bridge has to be visible to the classloader evaluating the logging configuration. Since Glassfish starts logging very early in its bootstrapping phase, the lib/endorsed folder is the only place where the bridge has the desired effect.

Is there another way to use slf4j with GlassFish server on JDK 11?

0 Answers
Related