Integrate Spring Geode Logging with Spring Boot Logging and externalizes configuration.

* Deprecates the logback-include.xml file.
* Declare the logging context name as 'geodeLoggingContext'.
* Determines whether Spring Boot SLF4J Logback logging configuration (metadata) files are present on the application classpath.
* Applies custom logging configuration declared by the user in the spring-geode-logging.properties file on the application classpath.
* Conditionally includes SLF4J Logback logging configuration from Spring Boot.
* Includes Appenders, Loggers and Properties configuration metadata files from Spring Geode Starter Logging.

Resolves #117.
This commit is contained in:
John Blum
2022-07-06 14:29:55 -07:00
parent c420896c24
commit 7e301c51f2
2 changed files with 22 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DEPRECATED -->
<included>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">

View File

@@ -1,12 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<contextName>geodeLoggingContext</contextName>
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
<include resource="logback-include.xml"/>
<define name="bootPresent" class="ch.qos.logback.core.property.ResourceExistsPropertyDefiner">
<resource>org/springframework/boot/logging/logback/defaults.xml</resource>
</define>
<include resource="org/springframework/geode/logging/slf4j/logback/properties-include.xml"/>
<variable resource="spring-geode-logging.properties"/>
<if condition='property("bootPresent").equals("true")'>
<then>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/file-appender.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
</then>
</if>
<include resource="org/springframework/geode/logging/slf4j/logback/appender-include.xml"/>
<include resource="org/springframework/geode/logging/slf4j/logback/logger-include.xml"/>
<root level="${logback.root.log.level:-INFO}">
<appender-ref ref="console"/>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="delegate"/>
</root>