Skip to content

When using Log4j2 log4j2.properties files are not detected #16262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -210,7 +210,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 @@ -240,7 +240,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