forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply min-level logging config to root logger quarkusio#20066
(cherry picked from commit 190df7e)
- Loading branch information
Showing
7 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...l-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelGlobalTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package io.quarkus.it.logging.minlevel.unset; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.CoreMatchers.is; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.common.QuarkusTestResource; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
/** | ||
* Tests that logging works as expected when min-level is default, | ||
* and the global log level is below it. | ||
*/ | ||
@QuarkusTest | ||
@QuarkusTestResource(SetGlobalRuntimeLogLevel.class) | ||
public class LoggingMinLevelGlobalTest { | ||
|
||
@Test | ||
public void testInfo() { | ||
given() | ||
.when().get("/log/bydefault/info") | ||
.then() | ||
.statusCode(200) | ||
.body(is("true")); | ||
} | ||
|
||
@Test | ||
public void testWarn() { | ||
given() | ||
.when().get("/log/bydefault/warn") | ||
.then() | ||
.statusCode(200) | ||
.body(is("true")); | ||
} | ||
|
||
@Test | ||
public void testNotTrace() { | ||
given() | ||
.when().get("/log/bydefault/not-trace") | ||
.then() | ||
.statusCode(200) | ||
.body(is("true")); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...el-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/SetGlobalRuntimeLogLevel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.quarkus.it.logging.minlevel.unset; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; | ||
|
||
public final class SetGlobalRuntimeLogLevel implements QuarkusTestResourceLifecycleManager { | ||
|
||
@Override | ||
public Map<String, String> start() { | ||
final Map<String, String> systemProperties = new HashMap<>(); | ||
systemProperties.put("quarkus.log.level", "TRACE"); | ||
return systemProperties; | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
} | ||
|
||
} |