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

Consider adding a spring-geode-starter-logging module #73

Closed jxblum closed 4 years ago

jxblum commented 4 years ago

Now that Apache Geode logging only works when...

1) The application classpath has been properly configured with a logging provider (e.g. SLF4J and Logback) and an associated adapter/bridge JAR between Log4j (used by Apache Geode for logging) and your Spring application's logging provider if not Log4j itself (e.g. org.apache.logging.log4j:log4j-to-slf4j) along with...

2) A logging provider configuration file (e.g. logback.xml) ...

Then Apache Geode will not log any output at all.

SDG's old @EnableLogging annotation not longer has any effect given the recent logging behavioral changes in Apache Geode since 1.9.2. See DATAGEODE-299 for more details.

This improvement would include:

1) New Spring Boot starters to enable logging for Apache Geode and Pivotal GemFire, respectively: spring-geode-starter-logging and spring-gemfire-starter-logging.

2) These new Spring Boot logging starters would additionally include the org.springframework.boot:spring-boot-starter-logging, by default.

3) Given spring-boot-starter-logging (transitively) includes the SLF4J as the opinionated logging API for Spring Boot applications to construct log statements along with Logback as the default logging provider, then SBDG will provide a default logback.xml configuration file with a Logger for org.apache.geode, similar to: https://github.com/spring-projects/spring-boot-data-geode/blob/1.3.0.M1/spring-geode-autoconfigure/src/test/resources/logback.xml

NOTE: the spring-boot-starter-logging dependency also adds the appropriate adapter/bride JAR (i.e. org.apache.logging.log4j:log4j-to-slf4j) to the application classpath.

4) Additionally, users will be able to adjust the log level for Apache Geode since the org.apache.geode Logger log-level will be parameterized using a property (for example) that can be set in Java System Properties when launching the Spring Boot application. This property will have a name of spring.boot.data.geode.log.level.