]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4999 Remove duplicate messages from logfile when console is enabled
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 7 Feb 2014 14:45:58 +0000 (15:45 +0100)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 7 Feb 2014 14:47:31 +0000 (15:47 +0100)
sonar-core/src/main/java/org/sonar/core/config/Logback.java

index e9fb414675b0404dfdf2aae29da61722b9acb7b5..8749749b79b517a3d601c376c9fadc5ce3bb42b5 100644 (file)
@@ -77,6 +77,7 @@ public class Logback implements BatchComponent, ServerComponent {
       if (isConsoleEnabled(substitutionVariables)) {
         Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
         rootLogger.setAdditive(false);
+        rootLogger.detachAppender("LOGFILE");
         rootLogger.addAppender(consoleAppender(lc, substitutionVariables));
       }
     } catch (JoranException e) {
@@ -101,7 +102,7 @@ public class Logback implements BatchComponent, ServerComponent {
 
   private static Appender<ILoggingEvent> consoleAppender(LoggerContext context, Map<String, String> substitutionVariables) {
     PatternLayoutEncoder encoder = new PatternLayoutEncoder();
-    encoder.setPattern(substitutionVariables.get("CONSOLE_LOGGING_FORMAT"));
+    encoder.setPattern(substitutionVariables.get("LOGFILE_LOGGING_FORMAT"));
     encoder.setContext(context);
     encoder.start();
     ConsoleAppender<ILoggingEvent> console = new ConsoleAppender<ILoggingEvent>();