Skip to content

Commit 79ed46c

Browse files
Lauretttaadamretter
authored andcommitted
[bugfix] Normalise Log4j2 config path to file: URI for cross-platform compatibility
Log4j2 cannot resolve a bare Windows path set via the log4j2.configurationFile system property. Converting to a file: URI ensures correct resolution on all platforms.
1 parent 350014b commit 79ed46c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • exist-start/src/main/java/org/exist/start

exist-start/src/main/java/org/exist/start/Main.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ public void runEx(String[] args) throws StartException {
279279
if (existHomeDir.isPresent() && Files.exists(existHomeDir.get().resolve(CONFIG_DIR_NAME))) {
280280
log4jConfigurationFile = existHomeDir.map(f -> f.resolve(CONFIG_DIR_NAME).resolve("log4j2.xml"));
281281
}
282+
}
282283

283-
if (log4jConfigurationFile.isPresent() && Files.isReadable(log4jConfigurationFile.get())) {
284-
// System.setProperty(PROP_LOG4J_CONFIGURATION_FILE, log4jConfigurationFile.get().toUri().toASCIIString());
285-
System.setProperty(PROP_LOG4J_CONFIGURATION_FILE, log4jConfigurationFile.get().toAbsolutePath().toString());
286-
}
284+
// Always normalise to a file:/ URI so log4j can resolve it on all platforms (especially Windows)
285+
if (log4jConfigurationFile.isPresent() && Files.isReadable(log4jConfigurationFile.get())) {
286+
System.setProperty(PROP_LOG4J_CONFIGURATION_FILE, log4jConfigurationFile.get().toAbsolutePath().toUri().toString());
287287
}
288288

289289
if (log4jConfigurationFile.isPresent()) {

0 commit comments

Comments
 (0)