Skip to content

Commit 3f556d8

Browse files
committed
PLUGINAPI-36 Document default log level with LogTester
1 parent a10ac77 commit 3f556d8

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
* Replace ~~`org.sonar.api.utils.log.Logger`~~ by `org.slf4j.Logger`
1212
* Utility classes used to test logs have been moved to a separate artifact `org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures` and moved to a new package:
1313
* `org.sonar.api.utils.log.LogTester` → `org.sonar.api.testfixtures.log.LogTester`
14-
* `org.sonar.api.utils.log.LogTesterJUnit5` → `org.sonar.api.testfixtures.log.LogTesterJUnit5`
14+
* `org.sonar.api.utils.log.LogTesterJUnit5` → `org.sonar.api.testfixtures.log.LogTesterJUnit5`
15+
* **Breaking change for tests**: the default log level when using `LogTester` is now `INFO`. This is consistent with the default behavior of Sonar products. If you want to assert `DEBUG` or `TRACE` logs in your tests, you should first change the log level by using for example `logTester.setLevel(Level.DEBUG)`.

test-fixtures/src/main/java/org/sonar/api/testfixtures/log/LogTester.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
import org.junit.runners.model.Statement;
2525

2626
/**
27-
* <b>For tests only</b>
28-
* <br>
29-
* This JUnit rule allows to configure and access logs in tests. By default
30-
* trace level is enabled.
27+
* This JUnit rule allows to configure and access logs in tests. By default,
28+
* INFO level is enabled.
3129
* <br>
3230
* Warning - not compatible with parallel execution of tests in the same JVM fork.
3331
* <br>

test-fixtures/src/main/java/org/sonar/api/testfixtures/log/LogTesterJUnit5.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
import org.junit.jupiter.api.extension.ExtensionContext;
2525

2626
/**
27-
* <b>For tests only</b>
28-
* <br>
29-
* This JUnit 5 extension allows to configure and access logs in tests. By default
30-
* trace level is enabled.
27+
* This JUnit 5 extension allows to configure and access logs in tests. By default,
28+
* INFO level is enabled.
3129
* <br>
3230
* Warning - not compatible with parallel execution of tests in the same JVM fork.
3331
* <br>

0 commit comments

Comments
 (0)