problems with getting basic logging up with springboot and logback problems with getting basic logging up with springboot and logback spring spring

problems with getting basic logging up with springboot and logback


well what do you know - dependency management issue - the latest springboot-starter-logging is only using slf4j-api.1.7.13,

however if you get the latest logback which i did logback_classic.1.1.5 there was breaking issue somewhere in the Api client librray that didnt export the class - which is why it couldnt be found. see logback issue/news

if you explicitly add the dependency

...compile 'ch.qos.logback:logback-classic:1.1.5'compile 'org.slf4j:slf4j-api:1.7.16'

to gradle.build, refresh and retry it all starts to work as nature expected. Blimey painful as usual as these things normally are


java.lang.NoClassDefFoundError: org/slf4j/event/LoggingEvent

Logback-classic version 1.1.4 and later require slf4j-api version 1.7.15 or later.With an earlier slf4j-api.jar in the classpath, attempting introspection of a Logger instance returned by logback version 1.1.4 or later will result in a NoClassDefFoundError similar to that shown below.

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/event/LoggingEvent    at java.lang.Class.getDeclaredMethods0(Native Method)    at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)    at java.lang.Class.privateGetPublicMethods(Class.java:2571)    at java.lang.Class.getMethods(Class.java:1429)    at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1261)    at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1122)    at java.beans.Introspector.getBeanInfo(Introspector.java:414)    at java.beans.Introspector.getBeanInfo(Introspector.java:161)

Placing slf4j-api.jar version 1.7.15 or later in the classpath should solve the issue.Note that this problem only occurs with logback version 1.1.4 and later, other bindings such as slf4j-log4j, slf4j-jdk14 and slf4j-simple are unaffected.


corresponding maven dependency missing got it from https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.15

<dependency>            <groupId>org.slf4j</groupId>            <artifactId>slf4j-api</artifactId>            <version>1.7.15</version>        </dependency>