]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15827 Fix SSF-219
authorJacek <jacek.poreda@sonarsource.com>
Mon, 13 Dec 2021 16:24:23 +0000 (17:24 +0100)
committerPhilippe Perrin <philippe.perrin@sonarsource.com>
Wed, 15 Dec 2021 13:25:28 +0000 (14:25 +0100)
build.gradle
server/sonar-main/build.gradle
server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java
server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java

index 7e6aa9d0de6719f74ec7f18e530dd5c55f5c8d3c..91ccc590eba9815eb6a4553c30a833e1bb8efa44 100644 (file)
@@ -371,10 +371,10 @@ subprojects {
         exclude 'commons-logging:commons-logging'
       }
       // Be aware that Log4j is used by Elasticsearch client
-      dependencySet(group: 'org.apache.logging.log4j', version: '2.8.2') {
+      dependencySet(group: 'org.apache.logging.log4j', version: '2.15.0') {
+        entry 'log4j-core'
         entry 'log4j-api'
         entry 'log4j-to-slf4j'
-        entry 'log4j-core'
       }
       dependencySet(group: 'org.apache.tomcat.embed', version: '8.5.72') {
         entry 'tomcat-embed-core'
@@ -395,7 +395,7 @@ subprojects {
         entry 'jetty-servlet'
       }
       dependency('org.elasticsearch.client:elasticsearch-rest-high-level-client:7.14.1') {
-        exclude 'commons-logging:commons-logging'
+        exclude 'org.apache.logging.log4j:log4j-core'
       }
       dependency 'org.elasticsearch.plugin:transport-netty4-client:7.14.1'
       dependency 'org.elasticsearch:mocksocket:1.0'
index 2e11dd66e757f36fb21517fff334d8eaa41d62de..651109f9c5608fd7715401ebeee7315d3c3b141e 100644 (file)
@@ -19,7 +19,6 @@ dependencies {
   compile 'org.apache.logging.log4j:log4j-api'
   compile 'org.elasticsearch.client:elasticsearch-rest-high-level-client'
   compile 'org.elasticsearch:elasticsearch'
-  compile 'org.elasticsearch:elasticsearch-core'
   compile 'org.slf4j:slf4j-api'
   compile 'org.yaml:snakeyaml'
   
index 89a2e99aae08b5f42c6ad224802ae35a39da3728..09ac20a21993824b66cf21f3e6a61f6603a51845 100644 (file)
@@ -71,17 +71,6 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> {
     // 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");
 
-    // JDK 8 GC logging (by default ES 6.6.1 enables them, we don't want to do that in SQ, no one will analyze them anyway)
-    // res.put("8:-XX:+PrintGCDetails", "");
-    // res.put("8:-XX:+PrintGCDateStamps", "");
-    // res.put("8:-XX:+PrintTenuringDistribution", "");
-    // res.put("8:-XX:+PrintGCApplicationStoppedTime", "");
-    // res.put("8:-Xloggc:logs/gc.log", "");
-    // res.put("8:-XX:+UseGCLogFileRotation", "");
-    // res.put("8:-XX:NumberOfGCLogFiles", "32");
-    // res.put("8:-XX:GCLogFileSize", "64m");
-    // JDK 9+ GC logging
-    // res.put("9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m", "");
   }
 
   /**
@@ -121,6 +110,7 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> {
     // log4j 2
     res.put("-Dlog4j.shutdownHookEnabled=", "false");
     res.put("-Dlog4j2.disable.jmx=", "true");
+    res.put("-Dlog4j2.formatMsgNoLookups=", "true");
     /*
      * Due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise time/date
      * parsing will break in an incompatible way for some date patterns and locales.
index a4c7c3bcc9168015c541592ed914996155ea2c5d..92620a037c5c63fb7b6d8b4b14b99a16156ca020 100644 (file)
@@ -49,7 +49,7 @@ public class EsJvmOptionsTest {
     EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);
 
     assertThat(underTest.getAll())
-      .containsExactly(
+      .containsExactlyInAnyOrder(
         "-XX:+UseG1GC",
         "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(),
         "-XX:ErrorFile=../logs/es_hs_err_pid%p.log",
@@ -67,6 +67,7 @@ public class EsJvmOptionsTest {
         "-Dio.netty.allocator.numDirectArenas=0",
         "-Dlog4j.shutdownHookEnabled=false",
         "-Dlog4j2.disable.jmx=true",
+        "-Dlog4j2.formatMsgNoLookups=true",
         "-Djava.locale.providers=COMPAT",
         "-Dcom.redhat.fips=false",
         "-Des.enforce.bootstrap.checks=true");
@@ -149,6 +150,7 @@ public class EsJvmOptionsTest {
         "-Dio.netty.allocator.numDirectArenas=0\n" +
         "-Dlog4j.shutdownHookEnabled=false\n" +
         "-Dlog4j2.disable.jmx=true\n" +
+        "-Dlog4j2.formatMsgNoLookups=true\n" +
         "-Djava.locale.providers=COMPAT\n" +
         "-Dcom.redhat.fips=false\n" +
         "-Des.enforce.bootstrap.checks=true\n" +