Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f1df366

Browse files
committed
Merge pull request spring-projects#16262 from mrifni
* pr/16262: Polish "Automatically detect log4j2.properties" Automatically detect log4j2.properties
2 parents 1261c39 + b894696 commit f1df366

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

‎spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -112,6 +112,7 @@ protected String[] getStandardConfigLocations() {
112112

113113
private String[] getCurrentlySupportedConfigLocations() {
114114
List<String> supportedConfigLocations = new ArrayList<>();
115+
supportedConfigLocations.add("log4j2.properties");
115116
if (isClassAvailable("com.fasterxml.jackson.dataformat.yaml.YAMLParser")) {
116117
Collections.addAll(supportedConfigLocations, "log4j2.yaml", "log4j2.yml");
117118
}

‎spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystemTests.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public void loggingThatUsesJulIsCaptured() {
211211
@Test
212212
public void configLocationsWithNoExtraDependencies() {
213213
assertThat(this.loggingSystem.getStandardConfigLocations())
214-
.contains("log4j2.xml");
214+
.contains("log4j2.properties", "log4j2.xml");
215215
}
216216

217217
@Test
@@ -241,7 +241,8 @@ public void configLocationsWithJacksonDatabindAndDataformatYaml() {
241241
@Test
242242
public void springConfigLocations() {
243243
String[] locations = getSpringConfigLocations(this.loggingSystem);
244-
assertThat(locations).isEqualTo(new String[] { "log4j2-spring.xml" });
244+
assertThat(locations).isEqualTo(
245+
new String[] { "log4j2-spring.properties", "log4j2-spring.xml" });
245246
}
246247

247248
@Test

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /