Skip to content

Commit

Permalink
SONAR-15827 Fix SSF-219
Browse files Browse the repository at this point in the history
  • Loading branch information
jacek-poreda-sonarsource authored and sonartech committed Dec 13, 2021
1 parent d85362e commit 8bc52d6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,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.68') {
entry 'tomcat-embed-core'
Expand Down Expand Up @@ -339,7 +339,7 @@ subprojects {
entry 'jetty-servlet'
}
dependency('org.elasticsearch.client:elasticsearch-rest-high-level-client:7.13.4') {
exclude 'commons-logging:commons-logging'
exclude 'org.apache.logging.log4j:log4j-core'
}
dependency 'org.elasticsearch.plugin:transport-netty4-client:7.13.4'
dependency 'org.elasticsearch:mocksocket:1.0'
Expand Down
1 change: 0 additions & 1 deletion server/sonar-main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,6 @@ private static void fromJvmDotOptionsFile(File tmpDir, Map<String, String> res)
// 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", "");
}

/**
Expand Down Expand Up @@ -123,6 +112,7 @@ private static void fromSystemJvmOptionsClass(Map<String, String> res) {
// 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void constructor_sets_mandatory_JVM_options() throws IOException {
EsJvmOptions underTest = new EsJvmOptions(new Props(properties), tmpDir);

assertThat(underTest.getAll())
.containsExactly(
.containsExactlyInAnyOrder(
"-XX:+UseConcMarkSweepGC",
"-XX:CMSInitiatingOccupancyFraction=75",
"-XX:+UseCMSInitiatingOccupancyOnly",
Expand All @@ -69,6 +69,7 @@ public void constructor_sets_mandatory_JVM_options() throws IOException {
"-Dio.netty.allocator.numDirectArenas=0",
"-Dlog4j.shutdownHookEnabled=false",
"-Dlog4j2.disable.jmx=true",
"-Dlog4j2.formatMsgNoLookups=true",
"-Djava.locale.providers=COMPAT",
"-Des.enforce.bootstrap.checks=true");
}
Expand Down Expand Up @@ -152,6 +153,7 @@ public void writeToJvmOptionFile_writes_all_JVM_options_to_file_with_warning_hea
"-Dio.netty.allocator.numDirectArenas=0\n" +
"-Dlog4j.shutdownHookEnabled=false\n" +
"-Dlog4j2.disable.jmx=true\n" +
"-Dlog4j2.formatMsgNoLookups=true\n" +
"-Djava.locale.providers=COMPAT\n" +
"-Des.enforce.bootstrap.checks=true\n" +
"-foo\n" +
Expand Down

0 comments on commit 8bc52d6

Please sign in to comment.