[logback-user] Issue with LoggerFactory on Java 9

Mark Raynsford list+ch.qos.logback at io7m.com
Fri Feb 9 17:36:48 CET 2018


Hello.

It seems that LoggerFactory misbehaves when used from a modular project:

I have a very simple repro case here:

  https://github.com/io7m/logback-bug-20180209

The error is:

Exception in thread "main" java.util.ServiceConfigurationError: ch.qos.logback.classic.spi.Configurator: module ch.qos.logback.classic does not declare `uses`
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
	at java.base/java.util.ServiceLoader.checkCaller(ServiceLoader.java:574)
	at java.base/java.util.ServiceLoader.<init>(ServiceLoader.java:503)
	at java.base/java.util.ServiceLoader.load(ServiceLoader.java:1639)
	at ch.qos.logback.classic/ch.qos.logback.classic.util.EnvUtil.loadFromServiceLoader(EnvUtil.java:48)
	at ch.qos.logback.classic/ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:155)
	at ch.qos.logback.classic/ch.qos.logback.classic.spi.LogbackServiceProvider.initializeLoggerContext(LogbackServiceProvider.java:49)
	at ch.qos.logback.classic/ch.qos.logback.classic.spi.LogbackServiceProvider.initialize(LogbackServiceProvider.java:40)
	at org.slf4j/org.slf4j.LoggerFactory.bind(LoggerFactory.java:153)
	at org.slf4j/org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:141)
	at org.slf4j/org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:419)
	at org.slf4j/org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:405)
	at org.slf4j/org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:354)
	at org.slf4j/org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:380)
	at com.io7m.bugs.logback/com.io7m.bugs.logback.Main.<clinit>(Main.java:8)

The code simply calls:

  private static final Logger LOG = LoggerFactory.getLogger(Main.class);

... with a module descriptor:

module com.io7m.bugs.logback
{
  requires org.slf4j;
}

-- 
Mark Raynsford | http://www.io7m.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20180209/78a3da74/attachment.sig>


More information about the logback-user mailing list