-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cover quarkus.log.min-level scenario
- Loading branch information
pablo gonzalez granados
committed
Sep 10, 2021
1 parent
564d327
commit 9bdc045
Showing
3 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
javaee-like-getting-started/src/main/java/io/quarkus/ts/core/LoggerResource.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,25 @@ | ||
package io.quarkus.ts.core; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.jboss.logging.Logger; | ||
|
||
@Path("/log") | ||
public class LoggerResource { | ||
|
||
private static final Logger LOG = Logger.getLogger(LoggerResource.class); | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public void logExample() { | ||
LOG.fatal("Fatal log example"); | ||
LOG.error("Error log example"); | ||
LOG.warn("Warn log example"); | ||
LOG.info("Info log example"); | ||
LOG.debug("Debug log example"); | ||
LOG.trace("Trace log example"); | ||
} | ||
} |
11 changes: 9 additions & 2 deletions
11
javaee-like-getting-started/src/main/resources/application.properties
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# Configuration file | ||
# key = value | ||
#When you set the logging level below the minimum logging level, you must adjust the minimum logging level as well. | ||
#Otherwise, the value of minimum logging level overrides the logging level. | ||
# DOC: | ||
# https://access.redhat.com/documentation/en-us/red_hat_build_of_quarkus/1.11/html-single/configuring_logging_with_quarkus/index#ref-example-logging-configuration_quarkus-configuring-logging | ||
# https://quarkus.io/guides/logging | ||
# https://quarkus.io/guides/all-config#quarkus-core_quarkus.log.min-level | ||
|
||
#quarkus.log.min-level=FATAL | ||
#quarkus.log.level=DEBUG |
30 changes: 30 additions & 0 deletions
30
javaee-like-getting-started/src/test/java/io/quarkus/ts/core/LoggerDefaultPropertiesIT.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,30 @@ | ||
package io.quarkus.ts.core; | ||
|
||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.bootstrap.RestService; | ||
import io.quarkus.test.scenarios.QuarkusScenario; | ||
import io.quarkus.test.services.QuarkusApplication; | ||
|
||
@QuarkusScenario | ||
public class LoggerDefaultPropertiesIT { | ||
|
||
@QuarkusApplication | ||
static final RestService app = new RestService(); | ||
|
||
@Test | ||
// TODO https://github.com/quarkusio/quarkus/pull/13376 | ||
@Disabled | ||
public void checkDefaultLogMinLevelIsDebug() { | ||
app.given().when().get("/log").then().statusCode(204); | ||
|
||
app.logs().assertContains("Fatal log example"); | ||
app.logs().assertContains("Error log example"); | ||
app.logs().assertContains("Warn log example"); | ||
app.logs().assertContains("Info log example"); | ||
app.logs().assertContains("Debug log example"); | ||
|
||
app.logs().assertDoesNotContain("Trace log example"); | ||
} | ||
} |