Skip to content

Commit 7422af0

Browse files
committed
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.
1 parent b0f83ea commit 7422af0

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

spring-geode-starter-logging/src/main/resources/logback-include.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- DEPRECATED -->
23
<included>
34

45
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">

spring-geode-starter-logging/src/main/resources/logback.xml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<configuration debug="false">
33

4+
<contextName>geodeLoggingContext</contextName>
5+
46
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>
57

6-
<include resource="logback-include.xml"/>
8+
<define name="bootPresent" class="ch.qos.logback.core.property.ResourceExistsPropertyDefiner">
9+
<resource>org/springframework/boot/logging/logback/defaults.xml</resource>
10+
</define>
11+
12+
<include resource="org/springframework/geode/logging/slf4j/logback/properties-include.xml"/>
13+
14+
<variable resource="spring-geode-logging.properties"/>
15+
16+
<if condition='property("bootPresent").equals("true")'>
17+
<then>
18+
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
19+
<include resource="org/springframework/boot/logging/logback/file-appender.xml"/>
20+
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
21+
</then>
22+
</if>
23+
24+
<include resource="org/springframework/geode/logging/slf4j/logback/appender-include.xml"/>
25+
<include resource="org/springframework/geode/logging/slf4j/logback/logger-include.xml"/>
726

827
<root level="${logback.root.log.level:-INFO}">
9-
<appender-ref ref="console"/>
28+
<appender-ref ref="CONSOLE"/>
1029
<appender-ref ref="delegate"/>
1130
</root>
1231

0 commit comments

Comments
 (0)