3

to be able to use spring-geode, i need to exclude starter-logging, otherwise i run into:

Caused by: java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLogger cannot be cast to org.apache.logging.log4j.core.Logger
at org.apache.geode.internal.logging.LogService.init(LogService.java:81) ~[geode-core-1.2.1.jar:na]
at org.apache.geode.internal.logging.LogService.<clinit>(LogService.java:72) ~[geode-core-1.2.1.jar:na]
... 41 common frames omitted

my POM now looks like this:

 <dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-logging</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.springframework.geode</groupId>
  <artifactId>spring-geode-starter</artifactId>
</dependency>
<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-geode</artifactId>
  <version>2.0.10.RELEASE</version>
</dependency>

what should i do?

  • Sounds like a conflict of logging dependencies. It would probably be better to exclude the log4j dependency from whatever pulls that in (or alternatively, exclude the log4j-over-slf4j if you actually want to use log4j). – Mark Rotteveel Oct 24 '18 at 19:49
  • Please take the time to correctly format everything before you post. – takendarkk Oct 24 '18 at 19:51

1 Answers1

5

Geode introduces logging dependencies (log4j) which collide with spring logging: https://mvnrepository.com/artifact/org.apache.geode/geode-core/1.7.0

Please see https://lists.apache.org/thread.html/311d0e4bf742a2477f337f1028bdf991d16560c1bb0e7cd0f0ea9c1d@<user.geode.apache.org>

Spring uses Logback by default. You'll need to change the logging framework to log4j https://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html#howto-configure-log4j-for-logging

ibexit
  • 3,465
  • 1
  • 11
  • 25
  • It does not look as nice as logback but it works. Thanks @ibexit – Marlon David Rodriguez Oct 24 '18 at 20:08
  • i don't get why these jokers want to force you to use some rando logger. the fact it falls over when it finds a different logger or a competing one is so ridiculous. should just randomly pick one for all anyone cares when multiple loggers found – bharal Apr 11 '23 at 23:19