aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java14
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTester.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java12
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java14
4 files changed, 21 insertions, 21 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java b/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java
index 66f5fe8ad0f..2e230fefc43 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/logs/DefaultProfilerTest.java
@@ -37,17 +37,17 @@ public class DefaultProfilerTest {
@Test
public void test_levels() throws Exception {
- // trace by default
- assertThat(underTest.isDebugEnabled()).isTrue();
- assertThat(underTest.isTraceEnabled()).isTrue();
+ // info by default
+ assertThat(underTest.isDebugEnabled()).isFalse();
+ assertThat(underTest.isTraceEnabled()).isFalse();
tester.setLevel(LoggerLevel.DEBUG);
assertThat(underTest.isDebugEnabled()).isTrue();
assertThat(underTest.isTraceEnabled()).isFalse();
- tester.setLevel(LoggerLevel.INFO);
- assertThat(underTest.isDebugEnabled()).isFalse();
- assertThat(underTest.isTraceEnabled()).isFalse();
+ tester.setLevel(LoggerLevel.TRACE);
+ assertThat(underTest.isDebugEnabled()).isTrue();
+ assertThat(underTest.isTraceEnabled()).isTrue();
}
@Test
@@ -71,7 +71,7 @@ public class DefaultProfilerTest {
timing = underTest.stopTrace();
assertThat(timing).isGreaterThan(0);
assertThat(tester.logs()).hasSize(2);
- assertThat(tester.logs().get(1)).startsWith("Register rules (done) | time=" + timing);
+ assertThat(tester.logs().get(1)).startsWith("Register rules (done) | time=" + timing);
tester.clear();
// info
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTester.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTester.java
index 923a8ed74b5..4290cc6d16b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTester.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/LogTester.java
@@ -66,7 +66,7 @@ public class LogTester extends ExternalResource {
// this shared instance breaks compatibility with parallel execution of tests
LogInterceptors.set(new ListInterceptor());
- setLevel(LoggerLevel.TRACE);
+ setLevel(LoggerLevel.INFO);
}
@Override
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java
index 0bf60d2fff3..9594a8523b7 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java
@@ -34,17 +34,17 @@ public class DefaultProfilerTest {
@Test
public void test_levels() throws Exception {
- // trace by default
- assertThat(underTest.isDebugEnabled()).isTrue();
- assertThat(underTest.isTraceEnabled()).isTrue();
+ // info by default
+ assertThat(underTest.isDebugEnabled()).isFalse();
+ assertThat(underTest.isTraceEnabled()).isFalse();
tester.setLevel(LoggerLevel.DEBUG);
assertThat(underTest.isDebugEnabled()).isTrue();
assertThat(underTest.isTraceEnabled()).isFalse();
- tester.setLevel(LoggerLevel.INFO);
- assertThat(underTest.isDebugEnabled()).isFalse();
- assertThat(underTest.isTraceEnabled()).isFalse();
+ tester.setLevel(LoggerLevel.TRACE);
+ assertThat(underTest.isDebugEnabled()).isTrue();
+ assertThat(underTest.isTraceEnabled()).isTrue();
}
@Test
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java
index 2e1c8fe86e0..f396b2f5d6b 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogTesterTest.java
@@ -28,19 +28,19 @@ public class LogTesterTest {
LogTester underTest = new LogTester();
@Test
- public void debugLevel() throws Throwable {
+ public void info_level_by_default() throws Throwable {
LoggerLevel initial = underTest.getLevel();
- // when LogTester is used, then debug logs are enabled by default
+ // when LogTester is used, then info logs are enabled by default
underTest.before();
- assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.TRACE);
- assertThat(Loggers.getFactory().getLevel()).isEqualTo(LoggerLevel.TRACE);
-
- // change
- underTest.setLevel(LoggerLevel.INFO);
assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.INFO);
assertThat(Loggers.getFactory().getLevel()).isEqualTo(LoggerLevel.INFO);
+ // change
+ underTest.setLevel(LoggerLevel.DEBUG);
+ assertThat(underTest.getLevel()).isEqualTo(LoggerLevel.DEBUG);
+ assertThat(Loggers.getFactory().getLevel()).isEqualTo(LoggerLevel.DEBUG);
+
// reset to initial level after execution of test
underTest.after();
assertThat(underTest.getLevel()).isEqualTo(initial);