diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2023-01-04 11:13:34 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-01-05 20:02:56 +0000 |
commit | 0611f1bd4d4e7132434d144a94996fe47a32e062 (patch) | |
tree | 25c66272a4a5498ad08c89a5e222653caa615637 /server/sonar-main/src/main/java | |
parent | c0511e62e7e50def346785d1b6de6cd74059cbb4 (diff) | |
download | sonarqube-0611f1bd4d4e7132434d144a94996fe47a32e062.tar.gz sonarqube-0611f1bd4d4e7132434d144a94996fe47a32e062.zip |
SONAR-17781 Allow overwriting path for 'es_hs_err_pid%p.log'
Diffstat (limited to 'server/sonar-main/src/main/java')
-rw-r--r-- | server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java b/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java index 19ab60e9164..89d289724a0 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java +++ b/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Paths; import java.util.LinkedHashMap; import java.util.Map; import java.util.stream.Collectors; @@ -43,7 +44,7 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> { // with some changes to fit running bundled in SQ private static Map<String, String> mandatoryOptions(File tmpDir, Props props) { Map<String, String> res = new LinkedHashMap<>(30); - fromJvmDotOptionsFile(tmpDir, res); + fromJvmDotOptionsFile(tmpDir, res, props); fromSystemJvmOptionsClass(tmpDir, res); boolean defaultDisableBootstrapChecks = props.value("sonar.jdbc.url", "").contains("jdbc:h2"); @@ -54,7 +55,7 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> { return res; } - private static void fromJvmDotOptionsFile(File tmpDir, Map<String, String> res) { + private static void fromJvmDotOptionsFile(File tmpDir, Map<String, String> res, Props props) { // GC configuration res.put("-XX:+UseG1GC", ""); @@ -70,7 +71,8 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> { // has sufficient space // res.put("-XX:HeapDumpPath", "data"); // specify an alternative path for JVM fatal error logs (ES 6.6.1 default is "logs/hs_err_pid%p.log") - res.put("-XX:ErrorFile=", "../logs/es_hs_err_pid%p.log"); + var path = Paths.get(props.value("sonar.path.logs", "logs"), "es_hs_err_pid%p.log"); + res.put("-XX:ErrorFile=", path.toAbsolutePath().toString()); } |