diff --git a/logging/jboss/src/main/java/io/quarkus/ts/logging/jboss/LogResource.java b/logging/jboss/src/main/java/io/quarkus/ts/logging/jboss/LogResource.java index 24a56d14dd..355e49bd9c 100644 --- a/logging/jboss/src/main/java/io/quarkus/ts/logging/jboss/LogResource.java +++ b/logging/jboss/src/main/java/io/quarkus/ts/logging/jboss/LogResource.java @@ -1,6 +1,7 @@ package io.quarkus.ts.logging.jboss; import javax.inject.Inject; +import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -42,7 +43,17 @@ public void addLogMessageInFieldWithCustomCategoryLogger(@PathParam("level") Str addLogMessage(customCategoryLog, level, message); } + @GET + 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"); + } + private void addLogMessage(Logger logger, String level, String message) { logger.log(Logger.Level.valueOf(level), message); } -} \ No newline at end of file +} diff --git a/logging/jboss/src/main/resources/application.properties b/logging/jboss/src/main/resources/application.properties index e69de29bb2..9b398dec72 100644 --- a/logging/jboss/src/main/resources/application.properties +++ b/logging/jboss/src/main/resources/application.properties @@ -0,0 +1,9 @@ +#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=DEBUG +quarkus.log.level=TRACE \ No newline at end of file diff --git a/logging/jboss/src/test/java/io/quarkus/ts/logging/jboss/LogResourceIT.java b/logging/jboss/src/test/java/io/quarkus/ts/logging/jboss/LogResourceIT.java index b879ba1c7c..8b14c6e3c3 100644 --- a/logging/jboss/src/test/java/io/quarkus/ts/logging/jboss/LogResourceIT.java +++ b/logging/jboss/src/test/java/io/quarkus/ts/logging/jboss/LogResourceIT.java @@ -4,6 +4,7 @@ import org.jboss.logging.Logger; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import io.quarkus.test.bootstrap.RestService; @@ -71,6 +72,23 @@ public void shouldCategoryBeWorkingOnlyForAffectedLoggers() { app.logs().assertContains(MESSAGE + "category2"); } + @Test + // TODO + // https://github.com/quarkusio/quarkus/issues/20066 + @Disabled + public void checkDefaultLogMinLevel() { + 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"); + + // the value of minimum logging level overrides the logging level + app.logs().assertDoesNotContain("Trace log example"); + } + private void verifyLoggingRules(BiConsumer writer) { // Added INFO log writer.accept(Logger.Level.INFO, MESSAGE + "1");