Class GradleDuplicateLoggingWorkaround

java.lang.Object
org.apache.polaris.test.commons.junit.GradleDuplicateLoggingWorkaround
All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.Extension

@Singleton public class GradleDuplicateLoggingWorkaround extends Object implements org.junit.jupiter.api.extension.BeforeAllCallback
JUnit extension + Singleton CDI bean that "fixes" test logging configuration.

This component removes the SLF4JBridgeHandler installed by Gradle, to prevent duplicate logging messages in tests. Without this fix, Gradle tests using JBoss LogManager (which is the default in Quarkus) will log each message twice: once via the SLF4JBridgeHandler, without any formatting, and once via the JBoss LogManager (with formatting). This is annoying because the non-formatted messages appear on the console, regardless of the log level.

Note: this issue has been reported to Quarkus and appears fixed, but only the formatting part is fixed, not the duplicate messages.

See Also:
  • Constructor Details

    • GradleDuplicateLoggingWorkaround

      public GradleDuplicateLoggingWorkaround()
  • Method Details

    • onStartup

      public void onStartup(@Observes @Priority(1) jakarta.enterprise.event.Startup event)
    • beforeAll

      public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
      Specified by:
      beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback