spring-projects / spring-boot-data-geode

Spring Boot support for Apache Geode and VMware GemFire
https://projects.spring.io/spring-boot
Apache License 2.0
46 stars 49 forks source link

Fix bug in Logging auto-configuration when user explicitly configures GemFire/Geode logging #85

Closed jxblum closed 4 years ago

jxblum commented 4 years ago

SBDG's Logging auto-configuration does not appropriately "get out of the way" when the user explicitly configures GemFire/Geode logging, specifically with SDG's @EnableLogging annotation.

This results in a RuntimeException thrown by Spring Boot due to a duplicate bean definition registration, which Spring Boot does not allow by default. That is, Spring Boot disables bean definition overriding and a user must explicitly configure bean definition overriding with the following Spring Boot property in application.properties (or other PropertySource):

spring.main.allow-bean-definition-overriding=true

This is also the workaround for this bug.

Additionally, a user may configure logging simply by set 1 of the 2 SDG properties:

spring.data.gemfire.logging.level=info
spring.data.gemfire.cache.log-level=${spring.data.gemfire.logging.level:info}

It is usually preferable to only configure 1 of the 2 properties, and specifically spring.data.gemfire.logging.level. However, either is acceptable and defining 1 property (e.g. spring.data.gemfire.cache.log-level) in terms of the other (i.e. spring.data.gemfire.logging.level) is beneficial, depending on the context.