aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/app/WebServerProcessLogging.java3
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java9
2 files changed, 12 insertions, 0 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/app/WebServerProcessLogging.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/app/WebServerProcessLogging.java
index b3bfdf3a06e..6a8536b9b95 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/app/WebServerProcessLogging.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/app/WebServerProcessLogging.java
@@ -23,6 +23,7 @@ import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.ConsoleAppender;
import ch.qos.logback.core.FileAppender;
import ch.qos.logback.core.encoder.Encoder;
import org.sonar.process.ProcessId;
@@ -80,10 +81,12 @@ public class WebServerProcessLogging extends ServerProcessLogging {
: helper.createPatternLayoutEncoder(context, buildDepractedLogPatrern(config));
FileAppender<ILoggingEvent> appender = helper.newFileAppender(context, props, DEPRECATION_LOG_FILE_PREFIX, encoder);
+ ConsoleAppender<ILoggingEvent> consoleAppender = helper.newConsoleAppender(context, "CONSOLE", encoder);
Logger deprecated = context.getLogger(DEPRECATION_LOGGER_NAME);
deprecated.setAdditive(false);
deprecated.addAppender(appender);
+ deprecated.addAppender(consoleAppender);
}
private static String buildDepractedLogPatrern(RootLoggerConfig config) {
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java
index 35d9ee15e17..d09fbad5d47 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/app/WebServerProcessLoggingTest.java
@@ -558,6 +558,15 @@ public class WebServerProcessLoggingTest {
assertThat(fileAppender.getEncoder()).isInstanceOf(LayoutWrappingEncoder.class);
}
+ @Test
+ public void configure_shouldConfigureDeprecatedLoggerWithConsoleAppender() {
+ LoggerContext ctx = underTest.configure(props);
+
+ Logger root = ctx.getLogger("SONAR_DEPRECATION");
+ Appender<ILoggingEvent> appender = root.getAppender("CONSOLE");
+ assertThat(appender).isNotNull();
+ }
+
private void verifyRootLogLevel(LoggerContext ctx, Level expected) {
Logger rootLogger = ctx.getLogger(ROOT_LOGGER_NAME);
assertThat(rootLogger.getLevel()).isEqualTo(expected);