Skip to content

Commit ea7a3d3

Browse files
committed
fix: Always enable XML
Signed-off-by: Piotr P. Karwasz <[email protected]>
1 parent f8546d1 commit ea7a3d3

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,15 @@ protected String[] getStandardConfigLocations() {
125125
if (isClassAvailable(Log4J2RuntimeHints.JSON_TREE_PARSER_V2)) {
126126
Collections.addAll(locations, "log4j2-test.json", "log4j2-test.jsn");
127127
}
128-
if (isClassAvailable(Log4J2RuntimeHints.XML_TREE_PARSER)) {
129-
locations.add("log4j2-test.xml");
130-
}
128+
locations.add("log4j2-test.xml");
131129
locations.add("log4j2.properties");
132130
if (isClassAvailable(Log4J2RuntimeHints.YAML_TREE_PARSER_V2)) {
133131
Collections.addAll(locations, "log4j2.yaml", "log4j2.yml");
134132
}
135133
if (isClassAvailable(Log4J2RuntimeHints.JSON_TREE_PARSER_V2)) {
136134
Collections.addAll(locations, "log4j2.json", "log4j2.jsn");
137135
}
138-
if (isClassAvailable(Log4J2RuntimeHints.XML_TREE_PARSER)) {
139-
locations.add("log4j2.xml");
140-
}
136+
locations.add("log4j2.xml");
141137
String propertyDefinedLocation = new PropertiesUtil(new Properties())
142138
.getStringProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
143139
if (propertyDefinedLocation != null) {

core/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2RuntimeHints.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class Log4J2RuntimeHints implements RuntimeHintsRegistrar {
3232

3333
// Tree parsers used by Log4j 2 for configuration files.
3434
static final String JSON_TREE_PARSER_V2 = "com.fasterxml.jackson.databind.ObjectMapper";
35-
static final String XML_TREE_PARSER = "javax.xml.parsers.DocumentBuilderFactory";
3635
static final String YAML_TREE_PARSER_V2 = "com.fasterxml.jackson.dataformat.yaml.YAMLMapper";
3736

3837
// JUL implementations that use Log4j 2 API.
@@ -51,7 +50,6 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
5150
hints.resources().registerPattern("log4j2.springboot");
5251
// Declares the types that Log4j2LoggingSystem checks for existence reflectively.
5352
registerTypeForReachability(hints, classLoader, JSON_TREE_PARSER_V2);
54-
registerTypeForReachability(hints, classLoader, XML_TREE_PARSER);
5553
registerTypeForReachability(hints, classLoader, YAML_TREE_PARSER_V2);
5654
registerTypeForReachability(hints, classLoader, LOG4J_BRIDGE_HANDLER);
5755
registerTypeForReachability(hints, classLoader, LOG4J_LOG_MANAGER);

0 commit comments

Comments
 (0)