From 8be4f5b086485b2a9f83f88dfb6e66eece33d949 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Tue, 10 Aug 2021 07:57:05 -0500 Subject: [PATCH] SONAR-15244 Despite sonar.log.useJsonOutput is enabled some logs are still not in a JSON format --- .../java/org/sonar/application/command/EsJvmOptions.java | 1 - .../sonar/application/command/CommandFactoryImplTest.java | 6 +++--- .../org/sonar/application/command/EsJvmOptionsTest.java | 2 -- sonar-application/build.gradle | 4 ++++ 4 files changed, 7 insertions(+), 6 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 94ff737543d..9c96cc0e407 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 @@ -55,7 +55,6 @@ public class EsJvmOptions extends JvmOptions { private static void fromJvmDotOptionsFile(File tmpDir, Map res) { // GC configuration - res.put("-XX:+UseConcMarkSweepGC", ""); res.put("-XX:CMSInitiatingOccupancyFraction=", "75"); res.put("-XX:+UseCMSInitiatingOccupancyOnly", ""); diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java index ff12bbb68c6..b3bf9a7c1ce 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java @@ -134,7 +134,7 @@ public class CommandFactoryImplTest { assertThat(esConfig.getHttpPort()).isEqualTo(9001); assertThat(esConfig.getEsJvmOptions().getAll()) // enforced values - .contains("-XX:+UseConcMarkSweepGC", "-Dfile.encoding=UTF-8") + .contains("-Dfile.encoding=UTF-8") // default settings .contains("-Xms512m", "-Xmx512m", "-XX:+HeapDumpOnOutOfMemoryError"); assertThat(esConfig.getEsYmlSettings()).isNotNull(); @@ -169,7 +169,7 @@ public class CommandFactoryImplTest { assertThat(esConfig.getHttpPort()).isEqualTo(9001); assertThat(esConfig.getEsJvmOptions().getAll()) // enforced values - .contains("-XX:+UseConcMarkSweepGC", "-Dfile.encoding=UTF-8") + .contains("-Dfile.encoding=UTF-8") // default settings .contains("-Xms512m", "-Xmx512m", "-XX:+HeapDumpOnOutOfMemoryError"); assertThat(esConfig.getEsYmlSettings()).isNotNull(); @@ -209,7 +209,7 @@ public class CommandFactoryImplTest { assertThat(esConfig.getHttpPort()).isEqualTo(1234); assertThat(esConfig.getEsJvmOptions().getAll()) // enforced values - .contains("-XX:+UseConcMarkSweepGC", "-Dfile.encoding=UTF-8") + .contains("-Dfile.encoding=UTF-8") .contains("-Djava.io.tmpdir=" + tempDir.getAbsolutePath()) // user settings .contains("-Xms10G", "-Xmx10G") diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java index 62086882fd4..f3d78b6adfe 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java @@ -50,7 +50,6 @@ public class EsJvmOptionsTest { assertThat(underTest.getAll()) .containsExactly( - "-XX:+UseConcMarkSweepGC", "-XX:CMSInitiatingOccupancyFraction=75", "-XX:+UseCMSInitiatingOccupancyOnly", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(), @@ -133,7 +132,6 @@ public class EsJvmOptionsTest { "\n" + "# DO NOT EDIT THIS FILE\n" + "\n" + - "-XX:+UseConcMarkSweepGC\n" + "-XX:CMSInitiatingOccupancyFraction=75\n" + "-XX:+UseCMSInitiatingOccupancyOnly\n" + "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath() + "\n" + diff --git a/sonar-application/build.gradle b/sonar-application/build.gradle index 4edfac54339..652f8febbbe 100644 --- a/sonar-application/build.gradle +++ b/sonar-application/build.gradle @@ -108,6 +108,10 @@ task zip(type: Zip, dependsOn: [configurations.compile, downloadElasticSearch, v fcd.relativePath = new RelativePath(true, *path) } into("${archiveDir}/elasticsearch") + filesMatching('**/bin/elasticsearch-env') { + // to avoid warning logs + filter { line -> line.replaceAll('echo "warning: no-jdk distributions.*', ':') } + } // elasticsearch script will be replaced by patched version below exclude '**/bin/elasticsearch' exclude '**/bin/elasticsearch-cli' -- 2.39.5