diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-11-14 16:06:23 +0100 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-11-16 10:09:21 +0100 |
commit | 7c6a909d760e457af4259bf49bfbc6e1902d631b (patch) | |
tree | a47402a814b5095d239ba4921b893c5e702d7560 /server/sonar-search | |
parent | adf8fbe5364084c3da6d004d1ad55cba0620be4d (diff) | |
download | sonarqube-7c6a909d760e457af4259bf49bfbc6e1902d631b.tar.gz sonarqube-7c6a909d760e457af4259bf49bfbc6e1902d631b.zip |
SONAR-8333 restore process name in logs
because when running ITs with option -Dsonar.log.console we can't make a difference between logs from each process anymore
Diffstat (limited to 'server/sonar-search')
-rw-r--r-- | server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java | 4 | ||||
-rw-r--r-- | server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java b/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java index 174733eb097..4667d67f051 100644 --- a/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java +++ b/server/sonar-search/src/main/java/org/sonar/search/SearchLogging.java @@ -23,6 +23,8 @@ import ch.qos.logback.classic.LoggerContext; import org.sonar.process.LogbackHelper; import org.sonar.process.Props; +import static org.sonar.process.LogbackHelper.RootLoggerConfig.newRootLoggerConfigBuilder; + public class SearchLogging { private LogbackHelper helper = new LogbackHelper(); @@ -31,7 +33,7 @@ public class SearchLogging { LoggerContext ctx = helper.getRootContext(); ctx.reset(); - helper.configureRootLogger(ctx, props, "", "es"); + helper.configureRootLogger(ctx, props, newRootLoggerConfigBuilder().setProcessName("es").setFileName("es").build()); return ctx; } diff --git a/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java b/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java index dde89d32d45..ab229e74a76 100644 --- a/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java +++ b/server/sonar-search/src/test/java/org/sonar/search/SearchLoggingTest.java @@ -79,6 +79,6 @@ public class SearchLoggingTest { assertThat(fileAppender.getFile()).isEqualTo(new File(logDir, "es.log").getAbsolutePath()); assertThat(fileAppender.getEncoder()).isInstanceOf(PatternLayoutEncoder.class); PatternLayoutEncoder encoder = (PatternLayoutEncoder) fileAppender.getEncoder(); - assertThat(encoder.getPattern()).isEqualTo("%d{yyyy.MM.dd HH:mm:ss} %-5level [][%logger{20}] %msg%n"); + assertThat(encoder.getPattern()).isEqualTo("%d{yyyy.MM.dd HH:mm:ss} %-5level es[][%logger{20}] %msg%n"); } } |