aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-main/src/main/java
diff options
context:
space:
mode:
authorZipeng WU <zipeng.wu@sonarsource.com>2022-08-02 15:41:42 +0200
committersonartech <sonartech@sonarsource.com>2022-08-03 20:03:24 +0000
commit44dcee705fa9582238aa7db8b4b5b5f1a0fec2b6 (patch)
tree9bdf4e030f16482e470ea4244d7f85877a50ecd4 /server/sonar-main/src/main/java
parent94fe8bdf97cfaa4cdbbd498ce4398e22c3ac710f (diff)
downloadsonarqube-44dcee705fa9582238aa7db8b4b5b5f1a0fec2b6.tar.gz
sonarqube-44dcee705fa9582238aa7db8b4b5b5f1a0fec2b6.zip
SONAR-17138 sonar.log rotation move inside Sonar Application process
Diffstat (limited to 'server/sonar-main/src/main/java')
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/AppLogging.java30
1 files changed, 2 insertions, 28 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/AppLogging.java b/server/sonar-main/src/main/java/org/sonar/application/AppLogging.java
index 87e26824b25..930f0cae918 100644
--- a/server/sonar-main/src/main/java/org/sonar/application/AppLogging.java
+++ b/server/sonar-main/src/main/java/org/sonar/application/AppLogging.java
@@ -146,11 +146,8 @@ public class AppLogging {
helper.enableJulChangePropagation(ctx);
configureConsole(ctx);
- if (helper.isAllLogsToConsoleEnabled(appSettings.getProps()) || !appSettings.getProps().valueAsBoolean("sonar.wrapped", false)) {
- configureWithLogbackWritingToFile(ctx);
- } else {
- configureWithWrapperWritingToFile(ctx);
- }
+ configureWithLogbackWritingToFile(ctx);
+
helper.apply(
LogLevelConfig.newBuilder(helper.getRootLoggerName())
.rootLevelFor(ProcessId.APP)
@@ -201,29 +198,6 @@ public class AppLogging {
}
/**
- * SQ has been started by the wrapper (ie. with sonar.sh) therefor, APP's System.out (and System.err) are written to
- * sonar.log by the wrapper.
- */
- private void configureWithWrapperWritingToFile(LoggerContext ctx) {
- // configure all logs (ie. root logger) to be written to console with formatting
- // in practice, this will be only APP's own logs as logs from sub processes are written to LOGGER_GOBBLER and
- // LOGGER_GOBBLER is configured below to be detached from root
- // logs are written to the console because we want them to be in sonar.log and the wrapper will write any log
- // from APP's System.out and System.err to sonar.log
- Logger rootLogger = ctx.getLogger(ROOT_LOGGER_NAME);
- Encoder<ILoggingEvent> encoder = helper.createEncoder(appSettings.getProps(), rootLoggerConfig, ctx);
- rootLogger.addAppender(createAppConsoleAppender(ctx, encoder));
-
- // in regular configuration, sub processes are not copying their logs to their System.out, so, the only logs to be
- // expected in LOGGER_GOBBLER are those before logback is setup in subprocesses or when JVM crashes
- // so, they must be printed to App's System.out as is (as they are already formatted) and the wrapper will write
- // them to sonar.log
- // logger is configured to be non additive as we don't want these logs written to sonar.log and duplicated in the
- // console with an incorrect formatting
- configureGobbler(ctx);
- }
-
- /**
* Configure the logger to which logs from sub processes are written to
* (called {@link StreamGobbler#LOGGER_GOBBLER}) by {@link StreamGobbler},
* to be: