diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-11-15 11:17:33 +0100 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-11-16 18:27:52 +0100 |
commit | 0518e8253c82e39e2d7c7d8aa82873edc32d442d (patch) | |
tree | a0ef4983f3ca89aeb44d26d0868bc5c34777352b /server/sonar-server | |
parent | 640a441d745476008b20006140c4d3b0e88d06b0 (diff) | |
download | sonarqube-0518e8253c82e39e2d7c7d8aa82873edc32d442d.tar.gz sonarqube-0518e8253c82e39e2d7c7d8aa82873edc32d442d.zip |
SONAR-8335 support properties to configure log level per JVM
Diffstat (limited to 'server/sonar-server')
3 files changed, 13 insertions, 8 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 201878865df..e756cd1c251 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,16 +19,19 @@ */ package org.sonar.ce.log; +import org.sonar.process.ProcessId; import org.sonar.process.Props; import org.sonar.server.app.ServerProcessLogging; +import static org.sonar.ce.log.CeLogging.MDC_CE_TASK_UUID; + /** * Configure logback for the Compute Engine process. Logs are written to file "ce.log" in SQ's log directory. */ public class CeProcessLogging extends ServerProcessLogging { public CeProcessLogging() { - super("ce", "%X{ceTaskUuid}"); + super(ProcessId.COMPUTE_ENGINE, "%X{" + MDC_CE_TASK_UUID + "}"); } @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 ec9f4e565d4..933f6800314 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 @@ -21,18 +21,19 @@ package org.sonar.server.app; import ch.qos.logback.classic.LoggerContext; import org.sonar.process.LogbackHelper; +import org.sonar.process.ProcessId; import org.sonar.process.Props; import org.sonar.server.platform.ServerLogging; import static org.sonar.process.LogbackHelper.RootLoggerConfig.newRootLoggerConfigBuilder; public abstract class ServerProcessLogging { - private final String processName; + private final ProcessId processId; private final String threadIdFieldPattern; private final LogbackHelper helper = new LogbackHelper(); - protected ServerProcessLogging(String processName, String threadIdFieldPattern) { - this.processName = processName; + protected ServerProcessLogging(ProcessId processId, String threadIdFieldPattern) { + this.processId = processId; this.threadIdFieldPattern = threadIdFieldPattern; } @@ -52,16 +53,16 @@ public abstract class ServerProcessLogging { private void configureRootLogger(Props props) { LogbackHelper.RootLoggerConfig config = newRootLoggerConfigBuilder() - .setProcessName(processName) + .setProcessName(processId.getKey()) .setThreadIdFieldPattern(threadIdFieldPattern) - .setFileNamePrefix(processName) + .setFileNamePrefix(processId.getKey()) .build(); String logPattern = helper.buildLogPattern(config); helper.configureGlobalFileLog(props, config, logPattern); helper.configureForSubprocessGobbler(props, logPattern); - helper.configureRootLogLevel(props); + helper.configureRootLogLevel(props, processId); ServerLogging.configureHardcodedLevels(helper); } 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 f10f249db8d..f4f0753f214 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 @@ -21,6 +21,7 @@ package org.sonar.server.app; import java.util.logging.LogManager; import org.slf4j.bridge.SLF4JBridgeHandler; +import org.sonar.process.ProcessId; import org.sonar.process.Props; /** @@ -29,7 +30,7 @@ import org.sonar.process.Props; public class WebServerProcessLogging extends ServerProcessLogging { public WebServerProcessLogging() { - super("web", "%X{UID}"); + super(ProcessId.WEB_SERVER, "%X{UID}"); } @Override |