Skip to content

Commit 081a8bb

Browse files
authored
Use absolute paths for logs locations in JVM options for test clusters (#93672) (#93673)
1 parent 96790d3 commit 081a8bb

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/LocalClusterFactory.java

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ public synchronized void start(Version version) {
132132
copyExtraConfigFiles();
133133
}
134134

135-
deleteGcLogs();
136135
writeConfiguration();
137136
createKeystore();
138137
addKeystoreSettings();
@@ -215,20 +214,6 @@ public void waitUntilReady() {
215214
}
216215
}
217216

218-
private void deleteGcLogs() {
219-
try (Stream<Path> logs = Files.list(logsDir)) {
220-
logs.filter(l -> l.getFileName().toString().startsWith("gc.log")).forEach(path -> {
221-
try {
222-
IOUtils.deleteWithRetry(path);
223-
} catch (IOException e) {
224-
throw new UncheckedIOException(e);
225-
}
226-
});
227-
} catch (IOException e) {
228-
throw new UncheckedIOException(e);
229-
}
230-
}
231-
232217
private void createConfigDirectory() {
233218
try {
234219
IOUtils.deleteWithRetry(configDir);
@@ -615,14 +600,13 @@ private Map<String, String> getEnvironmentVariables() {
615600
}
616601

617602
private Map<String, String> getJvmOptionsReplacements() {
618-
Path relativeLogsDir = workingDir.relativize(logsDir);
619603
return Map.of(
620604
"-XX:HeapDumpPath=data",
621-
"-XX:HeapDumpPath=" + relativeLogsDir,
605+
"-XX:HeapDumpPath=" + logsDir,
622606
"logs/gc.log",
623-
relativeLogsDir.resolve("gc.log").toString(),
607+
logsDir.resolve("gc.log").toString(),
624608
"-XX:ErrorFile=logs/hs_err_pid%p.log",
625-
"-XX:ErrorFile=" + relativeLogsDir.resolve("hs_err_pid%p.log")
609+
"-XX:ErrorFile=" + logsDir.resolve("hs_err_pid%p.log")
626610
);
627611
}
628612

0 commit comments

Comments
 (0)