File tree Expand file tree Collapse file tree 3 files changed +34
-6
lines changed
spring-boot-project/spring-boot/src
main/resources/org/springframework/boot/logging/logback
java/org/springframework/boot/logging/logback Expand file tree Collapse file tree 3 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,12 @@ Default logback configuration provided for import
5
5
-->
6
6
7
7
<included >
8
- <conversionRule conversionWord =" applicationName" converterClass =" org.springframework.boot.logging.logback.ApplicationNameConverter" />
9
- <conversionRule conversionWord =" clr" converterClass =" org.springframework.boot.logging.logback.ColorConverter" />
10
- <conversionRule conversionWord =" correlationId" converterClass =" org.springframework.boot.logging.logback.CorrelationIdConverter" />
11
- <conversionRule conversionWord =" esb" converterClass =" org.springframework.boot.logging.logback.EnclosedInSquareBracketsConverter" />
12
- <conversionRule conversionWord =" wex" converterClass =" org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
13
- <conversionRule conversionWord =" wEx" converterClass =" org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
8
+ <conversionRule conversionWord =" applicationName" class =" org.springframework.boot.logging.logback.ApplicationNameConverter" />
9
+ <conversionRule conversionWord =" clr" class =" org.springframework.boot.logging.logback.ColorConverter" />
10
+ <conversionRule conversionWord =" correlationId" class =" org.springframework.boot.logging.logback.CorrelationIdConverter" />
11
+ <conversionRule conversionWord =" esb" class =" org.springframework.boot.logging.logback.EnclosedInSquareBracketsConverter" />
12
+ <conversionRule conversionWord =" wex" class =" org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
13
+ <conversionRule conversionWord =" wEx" class =" org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
14
14
15
15
<property name =" CONSOLE_LOG_PATTERN" value =" ${CONSOLE_LOG_PATTERN:-%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd'T'HH:mm:ss.SSSXXX}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}){} %clr(${PID:-}){magenta} %clr(--- %esb(){APPLICATION_NAME}%esb{APPLICATION_GROUP}[%15.15t] ${LOG_CORRELATION_PATTERN:-}){faint}%clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
16
16
<property name =" CONSOLE_LOG_CHARSET" value =" ${CONSOLE_LOG_CHARSET:-${file.encoding:-UTF-8}}" />
Original file line number Diff line number Diff line change @@ -129,6 +129,22 @@ void cleanUp() {
129
129
((LoggerContext ) LoggerFactory .getILoggerFactory ()).stop ();
130
130
}
131
131
132
+ @ Test
133
+ void logbackDefaultsConfigurationDoesNotTriggerDeprecation (CapturedOutput output ) {
134
+ initialize (this .initializationContext , "classpath:logback-include-defaults.xml" , null );
135
+ this .logger .info ("Hello world" );
136
+ assertThat (getLineWithText (output , "Hello world" )).isEqualTo ("[INFO] - Hello world" );
137
+ assertThat (output .toString ()).doesNotContain ("WARN" ).doesNotContain ("deprecated" );
138
+ }
139
+
140
+ @ Test
141
+ void logbackBaseConfigurationDoesNotTriggerDeprecation (CapturedOutput output ) {
142
+ initialize (this .initializationContext , "classpath:logback-include-base.xml" , null );
143
+ this .logger .info ("Hello world" );
144
+ assertThat (getLineWithText (output , "Hello world" )).contains (" INFO " ).endsWith (": Hello world" );
145
+ assertThat (output .toString ()).doesNotContain ("WARN" ).doesNotContain ("deprecated" );
146
+ }
147
+
132
148
@ Test
133
149
@ ClassPathOverrides ({ "org.jboss.logging:jboss-logging:3.5.0.Final" , "org.apache.logging.log4j:log4j-core:2.19.0" })
134
150
void jbossLoggingRoutesThroughLog4j2ByDefault () {
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <configuration >
3
+ <include resource =" org/springframework/boot/logging/logback/defaults.xml" />
4
+ <appender name =" CONSOLE" class =" ch.qos.logback.core.ConsoleAppender" >
5
+ <encoder >
6
+ <pattern >[%p] - %m%n</pattern >
7
+ </encoder >
8
+ </appender >
9
+ <root level =" INFO" >
10
+ <appender-ref ref =" CONSOLE" />
11
+ </root >
12
+ </configuration >
You can’t perform that action at this time.
0 commit comments