Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1761

Logback 1.4.8 -> 1.4.10 breaks Spring Boot 3.1.2

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 1.4.11
    • None
    • logback-core
    • None

    Description

      I am using this just-released com.globalmentor:globalmentor-root:0.8.16 POM as a parent: https://github.com/globalmentor/globalmentor-root/blob/main/pom.xml . It sets the logback.version Maven property to 1.4.10, and then puts some Logback artifacts under dependency management.

      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-access</artifactId>
        <version>${logback.version}</version>
      </dependency>
      
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.version}</version>
      </dependency>
      
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-core</artifactId>
        <version>${logback.version}</version>
      </dependency>
      

      (Unfortunately Logback doesn't have a BOM; see SLF4J-437.)

      In my child POM I am using Spring Boot, with spring.boot.version similarly set to 3.1.2 in the parent POM:

      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring.boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      

      This all means that I am using Spring Boot 3.1.2, but pulling in logback-access, logback-classic, and logback-core at v1.4.10 to override the v1.4.8 brought in by spring-boot-starter-logging.

      Unfortunately when I run a Spring Boot application it gives me:

      Exception in thread "main" java.lang.AbstractMethodError: Receiver class org.springframework.boot.logging.logback.RootLogLevelConfigurator does not define or inherit an implementation of the resolved method 'abstract ch.qos.logback.classic.spi.Configurator$ExecutionStatus configure(ch.qos.logback.core.Context)' of interface ch.qos.logback.classic.spi.Configurator.
      	at ch.qos.logback.classic.util.ContextInitializer.invokeConfigure(ContextInitializer.java:122)
      	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:87)
      	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:65)
      	at ch.qos.logback.classic.spi.LogbackServiceProvider.initializeLoggerContext(LogbackServiceProvider.java:52)
      	at ch.qos.logback.classic.spi.LogbackServiceProvider.initialize(LogbackServiceProvider.java:41)
      	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:183)
      	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:170)
      	at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:455)
      	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:441)
      	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:390)
      	at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:121)
      	at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:95)
      	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
      	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
      	at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:185)
      	at ….main(….java:27)
      

      This tells me there is at least one of two problems going on:

      • Logback 1.4.10 is incompatible with Spring Boot 3.1.2, and/or
      • Something in logback-access, logback-classic, and logback-core at v1.4.10 depends on some other Logback artifact I missed, which is still set out v1.4.8 because of Spring Boot. (This second doubt, whether it proves true or not, is an indication that it might be a good idea to add a Logback BOM as is in progress for SLF4J in SLF4J-437.)

      You will know better than me what changed between Logback v1.4.8 and v1.4.10 that might be causing this message, or that might depend on some other updated Logback artifact.

      For now I will set logback.version back to 1.4.8 so the program will run, but this seems pretty urgent to address, either by fixing the incompatibility, or by providing a BOM to ensure that all artifacts are updated in sync.

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            garretwilson Garret Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: