aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-server/src/main/java/org/sonar/ce/log/CeProcessLogging.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/app/ServerProcessLogging.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/app/WebServerProcessLogging.java3
-rw-r--r--server/sonar-server/src/test/java/org/sonar/ce/log/CeProcessLoggingTest.java12
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java12
5 files changed, 34 insertions, 0 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/ce/log/CeProcessLogging.java b/server/sonar-server/src/main/java/org/sonar/ce/log/CeProcessLogging.java
index 039099aba68..bdf681b0c3f 100644
--- a/server/sonar-server/src/main/java/org/sonar/ce/log/CeProcessLogging.java
+++ b/server/sonar-server/src/main/java/org/sonar/ce/log/CeProcessLogging.java
@@ -19,6 +19,7 @@
*/
package org.sonar.ce.log;
+import ch.qos.logback.classic.Level;
import org.sonar.process.ProcessId;
import org.sonar.process.logging.LogDomain;
import org.sonar.process.logging.LogLevelConfig;
@@ -40,6 +41,7 @@ public class CeProcessLogging extends ServerProcessLogging {
logLevelConfigBuilder.levelByDomain("sql", ProcessId.COMPUTE_ENGINE, LogDomain.SQL);
logLevelConfigBuilder.levelByDomain("es", ProcessId.COMPUTE_ENGINE, LogDomain.ES);
JMX_RMI_LOGGER_NAMES.forEach(loggerName -> logLevelConfigBuilder.levelByDomain(loggerName, ProcessId.COMPUTE_ENGINE, LogDomain.JMX));
+ MSQDRIVER_LOGGER_NAMES_TO_TURN_OFF.forEach(loggerName -> logLevelConfigBuilder.immutableLevel(loggerName, Level.OFF));
}
@Override
diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/ServerProcessLogging.java b/server/sonar-server/src/main/java/org/sonar/server/app/ServerProcessLogging.java
index 6f3f8b586ef..ec64e4026f0 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/app/ServerProcessLogging.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/app/ServerProcessLogging.java
@@ -47,6 +47,11 @@ public abstract class ServerProcessLogging {
"sun.rmi.transport.misc",
"sun.rmi.server.call",
"sun.rmi.dgc");
+ protected static final Set<String> MSQDRIVER_LOGGER_NAMES_TO_TURN_OFF = ImmutableSet.of(
+ "com.microsoft.sqlserver.jdbc.internals",
+ "com.microsoft.sqlserver.jdbc.ResultSet",
+ "com.microsoft.sqlserver.jdbc.Statement",
+ "com.microsoft.sqlserver.jdbc.Connection");
private final ProcessId processId;
private final String threadIdFieldPattern;
private final LogbackHelper helper = new LogbackHelper();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/WebServerProcessLogging.java b/server/sonar-server/src/main/java/org/sonar/server/app/WebServerProcessLogging.java
index 98c79054720..e06a29973c4 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/app/WebServerProcessLogging.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/app/WebServerProcessLogging.java
@@ -19,6 +19,7 @@
*/
package org.sonar.server.app;
+import ch.qos.logback.classic.Level;
import java.util.logging.LogManager;
import org.slf4j.bridge.SLF4JBridgeHandler;
import org.sonar.process.ProcessId;
@@ -46,6 +47,8 @@ public class WebServerProcessLogging extends ServerProcessLogging {
logLevelConfigBuilder.offUnlessTrace("org.apache.catalina.core.ContainerBase");
logLevelConfigBuilder.offUnlessTrace("org.apache.catalina.core.StandardContext");
logLevelConfigBuilder.offUnlessTrace("org.apache.catalina.core.StandardService");
+
+ MSQDRIVER_LOGGER_NAMES_TO_TURN_OFF.forEach(loggerName -> logLevelConfigBuilder.immutableLevel(loggerName, Level.OFF));
}
@Override
diff --git a/server/sonar-server/src/test/java/org/sonar/ce/log/CeProcessLoggingTest.java b/server/sonar-server/src/test/java/org/sonar/ce/log/CeProcessLoggingTest.java
index 04bdb5f6e58..2e140fd9baf 100644
--- a/server/sonar-server/src/test/java/org/sonar/ce/log/CeProcessLoggingTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/ce/log/CeProcessLoggingTest.java
@@ -31,6 +31,7 @@ import ch.qos.logback.core.joran.spi.JoranException;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
+import java.util.stream.Stream;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Rule;
@@ -426,6 +427,17 @@ public class CeProcessLoggingTest {
verifyImmutableLogLevels(context);
}
+ @Test
+ public void configure_turns_off_some_MsSQL_driver_logger() {
+ LoggerContext context = underTest.configure(props);
+
+ Stream.of("com.microsoft.sqlserver.jdbc.internals",
+ "com.microsoft.sqlserver.jdbc.ResultSet",
+ "com.microsoft.sqlserver.jdbc.Statement",
+ "com.microsoft.sqlserver.jdbc.Connection")
+ .forEach(loggerName -> assertThat(context.getLogger(loggerName).getLevel()).isEqualTo(Level.OFF));
+ }
+
private void verifyRootLogLevel(LoggerContext ctx, Level expected) {
assertThat(ctx.getLogger(ROOT_LOGGER_NAME).getLevel()).isEqualTo(expected);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java b/server/sonar-server/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java
index 722978a3cab..2b13839bd55 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java
@@ -31,6 +31,7 @@ import ch.qos.logback.core.joran.spi.JoranException;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
+import java.util.stream.Stream;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Rule;
@@ -462,6 +463,17 @@ public class WebServerProcessLoggingTest {
assertThat(context.getLogger("org.apache.catalina.core.StandardService").getLevel()).isNull();
}
+ @Test
+ public void configure_turns_off_some_MsSQL_driver_logger() {
+ LoggerContext context = underTest.configure(props);
+
+ Stream.of("com.microsoft.sqlserver.jdbc.internals",
+ "com.microsoft.sqlserver.jdbc.ResultSet",
+ "com.microsoft.sqlserver.jdbc.Statement",
+ "com.microsoft.sqlserver.jdbc.Connection")
+ .forEach(loggerName -> assertThat(context.getLogger(loggerName).getLevel()).isEqualTo(Level.OFF));
+ }
+
private void verifyRootLogLevel(LoggerContext ctx, Level expected) {
Logger rootLogger = ctx.getLogger(ROOT_LOGGER_NAME);
assertThat(rootLogger.getLevel()).isEqualTo(expected);