Skip to content

Commit

Permalink
Merge pull request #1315 from michalvavrik/feature/install-jboss-log-…
Browse files Browse the repository at this point in the history
…handles-once

Install JBobss log handlers just once when multiple tests are run inside one test module and JBoss log manager is installed
  • Loading branch information
mjurc authored Sep 14, 2024
2 parents 1f368b0 + 3d2be90 commit 9d22ce8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions quarkus-test-core/src/main/java/io/quarkus/test/logging/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,13 @@ public static void configure(ScenarioContext scenario) {

// Remove existing handlers
for (Handler handler : logger.getHandlers()) {
// we don't need QuarkusDelayedHandler,
// and it leads to log duplication when the 'java.util.logging.manager'
// system property is set to the 'org.jboss.logmanager.LogManager'
if (handler instanceof QuarkusDelayedHandler) {
// JBosss context is saved statically and when more tests are run inside module
// while org.jboss.logmanager.LogManager is installed we add a new handlers in addition to previous ones
// it's desirable to install only a new handlers according to test configuration
// QuarkusDelayedHandler is removed as it duplicates logs when JBoss log manager is installed
if (handler instanceof QuarkusDelayedHandler || handler instanceof ConsoleHandler
|| handler instanceof FileHandler) {
logger.removeHandler(handler);
break;
}
}

Expand Down

0 comments on commit 9d22ce8

Please sign in to comment.