Skip to content

Commit

Permalink
Automatically detect log4j2.properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mrifni authored and snicoll committed Mar 29, 2019
1 parent 1261c39 commit 2cb4403
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ protected String[] getStandardConfigLocations() {

private String[] getCurrentlySupportedConfigLocations() {
List<String> supportedConfigLocations = new ArrayList<>();
supportedConfigLocations.add("log4j2.properties");
if (isClassAvailable("com.fasterxml.jackson.dataformat.yaml.YAMLParser")) {
Collections.addAll(supportedConfigLocations, "log4j2.yaml", "log4j2.yml");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public void loggingThatUsesJulIsCaptured() {
@Test
public void configLocationsWithNoExtraDependencies() {
assertThat(this.loggingSystem.getStandardConfigLocations())
.contains("log4j2.xml");
.contains("log4j2.properties", "log4j2.xml");
}

@Test
Expand Down Expand Up @@ -241,7 +241,8 @@ public void configLocationsWithJacksonDatabindAndDataformatYaml() {
@Test
public void springConfigLocations() {
String[] locations = getSpringConfigLocations(this.loggingSystem);
assertThat(locations).isEqualTo(new String[] { "log4j2-spring.xml" });
assertThat(locations).isEqualTo(
new String[] { "log4j2-spring.properties", "log4j2-spring.xml" });
}

@Test
Expand Down

0 comments on commit 2cb4403

Please sign in to comment.