Skip to content

Commit

Permalink
Cover quarkus.log.min-level scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo gonzalez granados committed Sep 10, 2021
1 parent 564d327 commit 9bdc045
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
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");
}
}
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
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");
}
}

0 comments on commit 9bdc045

Please sign in to comment.