diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-09-28 15:37:17 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-09-29 11:16:15 +0200 |
commit | 1067fc0a3adb177489c261b955b7ef3fe623a1be (patch) | |
tree | fe38a02af4ccccb53c2310bb6d5ee8d7b027029f /sonar-core | |
parent | d5dd60152c3408a1440e1ba6f6b1ce262ed2d488 (diff) | |
download | sonarqube-1067fc0a3adb177489c261b955b7ef3fe623a1be.tar.gz sonarqube-1067fc0a3adb177489c261b955b7ef3fe623a1be.zip |
Add to sonar.log the beginning and end of CE tasks
Diffstat (limited to 'sonar-core')
4 files changed, 14 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java b/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java index fbfce14c40f..9709521ae16 100644 --- a/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java +++ b/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java @@ -135,6 +135,11 @@ class DefaultProfiler extends Profiler { return doStop(LoggerLevel.INFO, message, args, ""); } + @Override + public long stopError(String message, Object... args) { + return doStop(LoggerLevel.ERROR, message, args, ""); + } + private Profiler doStart(LoggerLevel logLevel, String message, Object... args) { init(message, args); logStartMessage(logLevel, message, args); @@ -159,7 +164,7 @@ class DefaultProfiler extends Profiler { StringBuilder sb = new StringBuilder(); sb.append(message); appendContext(sb); - logger.trace(sb.toString(), args); + log(loggerLevel, sb.toString(), args); } } diff --git a/sonar-core/src/main/java/org/sonar/core/util/logs/NullProfiler.java b/sonar-core/src/main/java/org/sonar/core/util/logs/NullProfiler.java index eec8190f4db..fc17f498206 100644 --- a/sonar-core/src/main/java/org/sonar/core/util/logs/NullProfiler.java +++ b/sonar-core/src/main/java/org/sonar/core/util/logs/NullProfiler.java @@ -119,6 +119,11 @@ class NullProfiler extends Profiler { } @Override + public long stopError(String message, Object... args) { + return 0; + } + + @Override public Profiler addContext(String key, @Nullable Object value) { // nothing to do return this; diff --git a/sonar-core/src/main/java/org/sonar/core/util/logs/Profiler.java b/sonar-core/src/main/java/org/sonar/core/util/logs/Profiler.java index ee1487e54dd..15148450f3e 100644 --- a/sonar-core/src/main/java/org/sonar/core/util/logs/Profiler.java +++ b/sonar-core/src/main/java/org/sonar/core/util/logs/Profiler.java @@ -85,9 +85,10 @@ public abstract class Profiler { public abstract long stopInfo(String message, Object... args); + public abstract long stopError(String message, Object... args); + /** * Context information is removed if value is <code>null</code>. */ public abstract Profiler addContext(String key, @Nullable Object value); - } diff --git a/sonar-core/src/test/java/org/sonar/core/util/logs/NullProfilerTest.java b/sonar-core/src/test/java/org/sonar/core/util/logs/NullProfilerTest.java index 6572d4956d9..b9b404efce6 100644 --- a/sonar-core/src/test/java/org/sonar/core/util/logs/NullProfilerTest.java +++ b/sonar-core/src/test/java/org/sonar/core/util/logs/NullProfilerTest.java @@ -48,6 +48,7 @@ public class NullProfilerTest { assertThat(underTest.stopDebug("msg")).isEqualTo(0); assertThat(underTest.stopTrace()).isEqualTo(0); assertThat(underTest.stopTrace("msg")).isEqualTo(0); + assertThat(underTest.stopError("msg")).isEqualTo(0); } } |