From 9276e6c54b7c84d2db4571a930bf8141598e2e8c Mon Sep 17 00:00:00 2001 From: Jacek Date: Fri, 12 Feb 2021 17:45:12 +0100 Subject: [PATCH] SONAR-14455 Turn-off Elasticsearch 7.10.2 deprecation logging --- .../java/org/sonar/application/es/EsLogging.java | 4 ++++ .../org/sonar/application/es/EsLoggingTest.java | 13 +++++++++++-- .../org/sonar/server/log/ServerProcessLogging.java | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/server/sonar-main/src/main/java/org/sonar/application/es/EsLogging.java b/server/sonar-main/src/main/java/org/sonar/application/es/EsLogging.java index 1b0902a6a70..47c8a675a99 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/es/EsLogging.java +++ b/server/sonar-main/src/main/java/org/sonar/application/es/EsLogging.java @@ -47,6 +47,10 @@ public class EsLogging { log4JPropertiesBuilder.apply( LogLevelConfig.newBuilder(log4JPropertiesBuilder.getRootLoggerName()) .rootLevelFor(ProcessId.ELASTICSEARCH) + // turn off ES type deprecation logging to not flood logs + .immutableLevel("DEPRECATION", Level.ERROR) + .immutableLevel("org.elasticsearch.deprecation", Level.ERROR) + .immutableLevel("org.elasticsearch.client.RestClient", Level.ERROR) .build()); return log4JPropertiesBuilder.get(); diff --git a/server/sonar-main/src/test/java/org/sonar/application/es/EsLoggingTest.java b/server/sonar-main/src/test/java/org/sonar/application/es/EsLoggingTest.java index 6d92faf980e..f62d65b3766 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/es/EsLoggingTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/es/EsLoggingTest.java @@ -35,7 +35,7 @@ public class EsLoggingTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); - private EsLogging underTest = new EsLogging(); + private final EsLogging underTest = new EsLogging(); @Test public void createProperties_with_empty_props() throws IOException { @@ -64,7 +64,16 @@ public class EsLoggingTest { "appender.file_es.strategy.action.condition.nested_condition.type", "IfAccumulatedFileCount", "appender.file_es.strategy.action.condition.nested_condition.exceeds", "7", "rootLogger.level", "INFO", - "rootLogger.appenderRef.file_es.ref", "file_es"); + "rootLogger.appenderRef.file_es.ref", "file_es", + "loggers", "DEPRECATION,org.elasticsearch.client.RestClient,org.elasticsearch.deprecation", + "logger.org.elasticsearch.client.RestClient.name", "org.elasticsearch.client.RestClient", + "logger.org.elasticsearch.deprecation.level", "ERROR", + "logger.org.elasticsearch.deprecation.name", "org.elasticsearch.deprecation", + "logger.DEPRECATION.level", "ERROR", + "logger.DEPRECATION.name", "DEPRECATION", + "logger.org.elasticsearch.client.RestClient.level", "ERROR" + + ); } @Test diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/log/ServerProcessLogging.java b/server/sonar-server-common/src/main/java/org/sonar/server/log/ServerProcessLogging.java index 7eb374b344b..d2d82065df0 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/log/ServerProcessLogging.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/log/ServerProcessLogging.java @@ -77,6 +77,7 @@ public abstract class ServerProcessLogging { builder.immutableLevel("org.elasticsearch.http", Level.INFO); // turn off ES type deprecation logging to not flood logs + builder.immutableLevel("DEPRECATION", Level.ERROR); builder.immutableLevel("org.elasticsearch.deprecation", Level.ERROR); builder.immutableLevel("org.elasticsearch.client.RestClient", Level.ERROR); -- 2.39.5