From 1e1c2d00d6a04b13b35a7463c14a4a600213538d Mon Sep 17 00:00:00 2001 From: "David M. Lloyd" Date: Mon, 8 May 2023 13:09:03 -0500 Subject: [PATCH] Switch to `jboss-logmanager` Drop the old `jboss-logmanager-embedded` in favor of `jboss-logmanager`. --- bom/application/pom.xml | 27 +++---- core/builder/pom.xml | 2 +- .../logging/LoggingResourceProcessor.java | 11 +-- core/processor/pom.xml | 2 +- core/runtime/pom.xml | 24 +++++-- .../runtime/graal/LoggingSubstitutions.java | 8 +-- .../runtime/logging/BannerFormatter.java | 72 ------------------- .../runtime/logging/LoggingSetupRecorder.java | 26 +++---- .../asciidoc/class-loading-reference.adoc | 2 +- extensions/datasource/common/pom.xml | 4 +- extensions/devservices/db2/pom.xml | 4 +- extensions/devservices/derby/pom.xml | 6 +- extensions/devservices/h2/pom.xml | 6 +- extensions/devservices/mariadb/pom.xml | 6 +- extensions/devservices/mssql/pom.xml | 6 +- extensions/devservices/mysql/pom.xml | 6 +- extensions/devservices/oracle/pom.xml | 2 +- extensions/devservices/postgresql/pom.xml | 6 +- extensions/logging-json/runtime/pom.xml | 2 +- extensions/panache/panacheql/pom.xml | 6 +- .../vertx/latebound-mdc-provider/pom.xml | 2 +- .../mdc/provider/LateBoundMDCProvider.java | 10 +++ .../quarkus/vertx/core/runtime/VertxMDC.java | 9 +++ independent-projects/bootstrap/bom/pom.xml | 14 +++- .../bootstrap/maven-resolver/pom.xml | 2 +- independent-projects/bootstrap/pom.xml | 2 +- independent-projects/bootstrap/runner/pom.xml | 2 +- .../logging/EmptyLogContextConfigurator.java | 18 +++++ .../logging/InitialConfigurator.java | 17 +++-- ...rg.jboss.logmanager.LogContextConfigurator | 1 + ...rg.jboss.logmanager.LogContextInitializer} | 0 .../quarkus-banned-dependencies.xml | 3 - .../projects/classic/pom.xml | 2 +- .../java/org/acme/ClasspathResources.java | 2 +- .../projects/rr-with-json-logging/pom.xml | 2 +- .../java/org/acme/ClasspathResources.java | 2 +- 36 files changed, 147 insertions(+), 169 deletions(-) delete mode 100644 core/runtime/src/main/java/io/quarkus/runtime/logging/BannerFormatter.java create mode 100644 independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/EmptyLogContextConfigurator.java create mode 100644 independent-projects/bootstrap/runner/src/main/resources/META-INF/services/org.jboss.logmanager.LogContextConfigurator rename independent-projects/bootstrap/runner/src/main/resources/META-INF/services/{org.jboss.logmanager.EmbeddedConfigurator => org.jboss.logmanager.LogContextInitializer} (100%) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 5acc5e25034549..c4578d22db32fd 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -166,7 +166,7 @@ 3.7.0 3.2.0 4.2.0 - 1.1.1 + 3.0.0.Final 9.21.0 3.0.3 4.20.0 @@ -3229,8 +3229,15 @@ ${commons-logging-jboss-logging.version} + + org.jboss.logmanager jboss-logmanager-embedded + 1.2.0.Final + + + org.jboss.logmanager + jboss-logmanager ${jboss-logmanager.version} @@ -3238,8 +3245,8 @@ jboss-modules - org.glassfish - javax.json + org.eclipse.parsson + jakarta.json @@ -3247,13 +3254,6 @@ org.jboss.logmanager log4j2-jboss-logmanager ${log4j2-jboss-logmanager.version} - - - - org.jboss.logmanager - jboss-logmanager - - - - org.jboss.logmanager - jboss-logmanager - - diff --git a/core/builder/pom.xml b/core/builder/pom.xml index d0cf9c314a7293..bcb4f3bcfd078e 100644 --- a/core/builder/pom.xml +++ b/core/builder/pom.xml @@ -40,7 +40,7 @@ org.jboss.logmanager - jboss-logmanager-embedded + jboss-logmanager test diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java index 38882e3ec79505..dea7858ff5d350 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java @@ -14,6 +14,7 @@ import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Supplier; +import java.util.logging.ConsoleHandler; import java.util.logging.Filter; import java.util.logging.Formatter; import java.util.logging.Handler; @@ -38,7 +39,7 @@ import org.jboss.jandex.DotName; import org.jboss.jandex.IndexView; import org.jboss.logging.Logger; -import org.jboss.logmanager.EmbeddedConfigurator; +import org.jboss.logmanager.LogContextInitializer; import org.jboss.logmanager.LogManager; import org.objectweb.asm.Opcodes; @@ -74,7 +75,7 @@ import io.quarkus.deployment.builditem.WebSocketLogHandlerBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageSystemPropertyBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; -import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem; +import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.deployment.console.ConsoleInstalledBuildItem; import io.quarkus.deployment.console.QuarkusCommand; @@ -210,14 +211,14 @@ void setUpDefaultLogCleanupFilters(List logCleanupFil @BuildStep void miscSetup( - Consumer runtimeInit, + Consumer runtimeInit, Consumer systemProp, Consumer provider) { - runtimeInit.accept(new RuntimeInitializedClassBuildItem("org.jboss.logmanager.formatters.TrueColorHolder")); + runtimeInit.accept(new RuntimeReinitializedClassBuildItem(ConsoleHandler.class.getName())); systemProp .accept(new NativeImageSystemPropertyBuildItem("java.util.logging.manager", "org.jboss.logmanager.LogManager")); provider.accept( - new ServiceProviderBuildItem(EmbeddedConfigurator.class.getName(), InitialConfigurator.class.getName())); + new ServiceProviderBuildItem(LogContextInitializer.class.getName(), InitialConfigurator.class.getName())); } @BuildStep diff --git a/core/processor/pom.xml b/core/processor/pom.xml index 26431d454d2eaa..924a0ec3718835 100644 --- a/core/processor/pom.xml +++ b/core/processor/pom.xml @@ -46,7 +46,7 @@ org.jboss.logmanager - jboss-logmanager-embedded + jboss-logmanager test diff --git a/core/runtime/pom.xml b/core/runtime/pom.xml index 6184c4146b19cc..3d99ca83377748 100644 --- a/core/runtime/pom.xml +++ b/core/runtime/pom.xml @@ -59,7 +59,7 @@ org.jboss.logmanager - jboss-logmanager-embedded + jboss-logmanager org.jboss.logging @@ -148,8 +148,14 @@ io.quarkus:quarkus-bootstrap-runner + io.smallrye.common:smallrye-common-constraint + io.smallrye.common:smallrye-common-cpu + io.smallrye.common:smallrye-common-expression + io.smallrye.common:smallrye-common-function io.smallrye.common:smallrye-common-io - org.wildfly.common:wildfly-common + io.smallrye.common:smallrye-common-net + io.smallrye.common:smallrye-common-os + io.smallrye.common:smallrye-common-ref org.graalvm.sdk:graal-sdk org.graalvm.js:js org.graalvm.regex:regex @@ -162,7 +168,7 @@ io.quarkus:quarkus-bootstrap-maven-resolver org.slf4j:slf4j-api org.jboss.slf4j:slf4j-jboss-logmanager - org.jboss.logmanager:jboss-logmanager-embedded + org.jboss.logmanager:jboss-logmanager org.jboss.logging:jboss-logging org.apache.maven:maven-model org.apache.maven.resolver:maven-resolver-api @@ -208,11 +214,17 @@ io.quarkus:quarkus-development-mode-spi org.jboss.logging:jboss-logging - org.jboss.logmanager:jboss-logmanager-embedded - - org.wildfly.common:wildfly-common + org.jboss.logmanager:jboss-logmanager + + io.smallrye.common:smallrye-common-constraint + io.smallrye.common:smallrye-common-cpu + io.smallrye.common:smallrye-common-expression + io.smallrye.common:smallrye-common-function io.smallrye.common:smallrye-common-io + io.smallrye.common:smallrye-common-net + io.smallrye.common:smallrye-common-os + io.smallrye.common:smallrye-common-ref io.github.crac:org-crac diff --git a/core/runtime/src/main/java/io/quarkus/runtime/graal/LoggingSubstitutions.java b/core/runtime/src/main/java/io/quarkus/runtime/graal/LoggingSubstitutions.java index 560493a4074fd9..7e7992357acb3b 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/graal/LoggingSubstitutions.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/graal/LoggingSubstitutions.java @@ -1,9 +1,9 @@ package io.quarkus.runtime.graal; -import java.util.concurrent.atomic.AtomicReference; import java.util.logging.Handler; import org.jboss.logmanager.LogContext; +import org.jboss.logmanager.LogContextInitializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +21,8 @@ final class Target_org_jboss_logmanager_LoggerNode { @Alias - @RecomputeFieldValue(declClass = AtomicReference.class, kind = RecomputeFieldValue.Kind.NewInstance) - AtomicReference handlersRef; + @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias) + Handler[] handlers = LogContextInitializer.NO_HANDLERS; } @TargetClass(className = "org.slf4j.LoggerFactory") @@ -36,7 +36,7 @@ public static Logger getLogger(Class clazz) { } @TargetClass(InitialConfigurator.class) -final class Target_io_quarkus_runtime_logging_InitialConfigurator { +final class Target_io_quarkus_bootstrap_logging_InitialConfigurator { @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias) @Alias public static QuarkusDelayedHandler DELAYED_HANDLER = new QuarkusDelayedHandler(); diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/BannerFormatter.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/BannerFormatter.java deleted file mode 100644 index f8911753609a61..00000000000000 --- a/core/runtime/src/main/java/io/quarkus/runtime/logging/BannerFormatter.java +++ /dev/null @@ -1,72 +0,0 @@ -package io.quarkus.runtime.logging; - -import java.nio.charset.Charset; -import java.util.function.Supplier; -import java.util.logging.Formatter; -import java.util.logging.Handler; -import java.util.logging.LogRecord; - -import org.jboss.logmanager.ExtLogRecord; -import org.jboss.logmanager.formatters.ColorPatternFormatter; -import org.jboss.logmanager.formatters.FormatStep; -import org.jboss.logmanager.formatters.PatternFormatter; -import org.wildfly.common.annotation.NotNull; - -public class BannerFormatter extends ColorPatternFormatter { - - private final Supplier bannerSupplier; - private Formatter formatter; - private boolean isColorPattern; - - BannerFormatter(@NotNull Formatter formatter, boolean isColorPattern, Supplier bannerSupplier) { - this.formatter = formatter; - this.isColorPattern = isColorPattern; - this.bannerSupplier = bannerSupplier; - - if (isColorPattern) { - this.setPattern(((ColorPatternFormatter) formatter).getPattern()); - } else { - this.setPattern(((PatternFormatter) formatter).getPattern()); - } - } - - @Override - public String formatMessage(LogRecord logRecord) { - if (isColorPattern) { - return super.formatMessage(logRecord); - } else { - return formatter.format(logRecord); - } - } - - @Override - public void setSteps(FormatStep[] steps) { - if (isColorPattern) { - super.setSteps(steps); - } else { - ((PatternFormatter) formatter).setSteps(steps); - } - } - - @Override - public String format(ExtLogRecord extLogRecord) { - if (isColorPattern) { - return ((ColorPatternFormatter) formatter).format(extLogRecord); - } else { - return ((PatternFormatter) formatter).format(extLogRecord); - } - } - - @Override - public String getHead(Handler h) { - final String banner = bannerSupplier.get(); - final String encoding = h.getEncoding(); - final Charset charset; - try { - charset = encoding == null ? Charset.defaultCharset() : Charset.forName(encoding); - return charset.newEncoder().canEncode(banner) ? banner : ""; - } catch (IllegalArgumentException ignored) { - return ""; - } - } -} diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java index c337609399c57b..418fe3a1c9e6dd 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java @@ -26,13 +26,15 @@ import java.util.logging.LogManager; import java.util.logging.LogRecord; -import org.jboss.logmanager.EmbeddedConfigurator; +import org.jboss.logmanager.ExtFormatter; import org.jboss.logmanager.LogContext; +import org.jboss.logmanager.LogContextInitializer; import org.jboss.logmanager.Logger; import org.jboss.logmanager.errormanager.OnlyOnceErrorManager; import org.jboss.logmanager.filters.AllFilter; import org.jboss.logmanager.formatters.ColorPatternFormatter; import org.jboss.logmanager.formatters.PatternFormatter; +import org.jboss.logmanager.formatters.TextBannerFormatter; import org.jboss.logmanager.handlers.AsyncHandler; import org.jboss.logmanager.handlers.ConsoleHandler; import org.jboss.logmanager.handlers.FileHandler; @@ -266,7 +268,7 @@ public void accept(String categoryName, CategoryConfig config) { } addNamedHandlersToRootHandlers(config.handlers, namedHandlers, handlers, errorManager); InitialConfigurator.DELAYED_HANDLER.setAutoFlush(false); - InitialConfigurator.DELAYED_HANDLER.setHandlers(handlers.toArray(EmbeddedConfigurator.NO_HANDLERS)); + InitialConfigurator.DELAYED_HANDLER.setHandlers(handlers.toArray(LogContextInitializer.NO_HANDLERS)); return shutdownNotifier; } @@ -362,7 +364,7 @@ public static void initializeBuildTimeLogging(LogConfig config, LogBuildTimeConf } addNamedHandlersToRootHandlers(config.handlers, namedHandlers, handlers, errorManager); InitialConfigurator.DELAYED_HANDLER.setAutoFlush(false); - InitialConfigurator.DELAYED_HANDLER.setBuildTimeHandlers(handlers.toArray(EmbeddedConfigurator.NO_HANDLERS)); + InitialConfigurator.DELAYED_HANDLER.setBuildTimeHandlers(handlers.toArray(LogContextInitializer.NO_HANDLERS)); } private boolean shouldCreateNamedHandlers(LogConfig logConfig, @@ -556,21 +558,13 @@ private static Handler configureConsoleHandler(final ConsoleConfig config, bannerSupplier = possibleBannerSupplier.getValue().get(); } if (ColorSupport.isColorEnabled(consoleRuntimeConfig, config)) { + formatter = new ColorPatternFormatter(config.darken, config.format); color = true; - ColorPatternFormatter colorPatternFormatter = new ColorPatternFormatter(config.darken, - config.format); - if (bannerSupplier != null) { - formatter = new BannerFormatter(colorPatternFormatter, true, bannerSupplier); - } else { - formatter = colorPatternFormatter; - } } else { - PatternFormatter patternFormatter = new PatternFormatter(config.format); - if (bannerSupplier != null) { - formatter = new BannerFormatter(patternFormatter, false, bannerSupplier); - } else { - formatter = patternFormatter; - } + formatter = new PatternFormatter(config.format); + } + if (bannerSupplier != null) { + formatter = new TextBannerFormatter(bannerSupplier, ExtFormatter.wrap(formatter, false)); } } final ConsoleHandler consoleHandler = new ConsoleHandler( diff --git a/docs/src/main/asciidoc/class-loading-reference.adoc b/docs/src/main/asciidoc/class-loading-reference.adoc index a684cf3e667533..c0ec0659df36e5 100644 --- a/docs/src/main/asciidoc/class-loading-reference.adoc +++ b/docs/src/main/asciidoc/class-loading-reference.adoc @@ -150,7 +150,7 @@ or a `LinkageError` can occur. io.quarkus:quarkus-bootstrap-core io.quarkus:quarkus-development-mode-spi - org.jboss.logmanager:jboss-logmanager-embedded + org.jboss.logmanager:jboss-logmanager org.jboss.logging:jboss-logging org.ow2.asm:asm diff --git a/extensions/datasource/common/pom.xml b/extensions/datasource/common/pom.xml index adf4b76faecde7..6527c853e4c846 100644 --- a/extensions/datasource/common/pom.xml +++ b/extensions/datasource/common/pom.xml @@ -18,8 +18,8 @@ test - org.jboss.logmanager - jboss-logmanager-embedded + org.jboss.logmanager + jboss-logmanager test diff --git a/extensions/devservices/db2/pom.xml b/extensions/devservices/db2/pom.xml index 3b70046344628f..c36078a7301132 100644 --- a/extensions/devservices/db2/pom.xml +++ b/extensions/devservices/db2/pom.xml @@ -40,8 +40,8 @@ test - org.jboss.logmanager - jboss-logmanager-embedded + org.jboss.logmanager + jboss-logmanager test diff --git a/extensions/devservices/derby/pom.xml b/extensions/devservices/derby/pom.xml index 3187ee20cb35ba..ad142a4923234c 100644 --- a/extensions/devservices/derby/pom.xml +++ b/extensions/devservices/derby/pom.xml @@ -30,9 +30,9 @@ test - org.jboss.logmanager - jboss-logmanager-embedded - test + org.jboss.logmanager + jboss-logmanager + test diff --git a/extensions/devservices/h2/pom.xml b/extensions/devservices/h2/pom.xml index e01ae5f9430ff9..9f9f54654ea35b 100644 --- a/extensions/devservices/h2/pom.xml +++ b/extensions/devservices/h2/pom.xml @@ -26,9 +26,9 @@ test - org.jboss.logmanager - jboss-logmanager-embedded - test + org.jboss.logmanager + jboss-logmanager + test diff --git a/extensions/devservices/mariadb/pom.xml b/extensions/devservices/mariadb/pom.xml index 261b711299f3d2..3e3a536d05988f 100644 --- a/extensions/devservices/mariadb/pom.xml +++ b/extensions/devservices/mariadb/pom.xml @@ -40,9 +40,9 @@ test - org.jboss.logmanager - jboss-logmanager-embedded - test + org.jboss.logmanager + jboss-logmanager + test diff --git a/extensions/devservices/mssql/pom.xml b/extensions/devservices/mssql/pom.xml index 8c1439d22ed072..f08675a84f6cdd 100644 --- a/extensions/devservices/mssql/pom.xml +++ b/extensions/devservices/mssql/pom.xml @@ -40,9 +40,9 @@ test - org.jboss.logmanager - jboss-logmanager-embedded - test + org.jboss.logmanager + jboss-logmanager + test diff --git a/extensions/devservices/mysql/pom.xml b/extensions/devservices/mysql/pom.xml index 797c5b1984eba1..7aa75b4ff35ae6 100644 --- a/extensions/devservices/mysql/pom.xml +++ b/extensions/devservices/mysql/pom.xml @@ -36,9 +36,9 @@ test - org.jboss.logmanager - jboss-logmanager-embedded - test + org.jboss.logmanager + jboss-logmanager + test mysql diff --git a/extensions/devservices/oracle/pom.xml b/extensions/devservices/oracle/pom.xml index 4f15257cf56866..b92c58dbfab2bf 100644 --- a/extensions/devservices/oracle/pom.xml +++ b/extensions/devservices/oracle/pom.xml @@ -41,7 +41,7 @@ org.jboss.logmanager - jboss-logmanager-embedded + jboss-logmanager test diff --git a/extensions/devservices/postgresql/pom.xml b/extensions/devservices/postgresql/pom.xml index e88013895eab5b..2afa0b43847ed3 100644 --- a/extensions/devservices/postgresql/pom.xml +++ b/extensions/devservices/postgresql/pom.xml @@ -40,9 +40,9 @@ test - org.jboss.logmanager - jboss-logmanager-embedded - test + org.jboss.logmanager + jboss-logmanager + test diff --git a/extensions/logging-json/runtime/pom.xml b/extensions/logging-json/runtime/pom.xml index eb0a195958a2a7..a01ec677bc2ed2 100644 --- a/extensions/logging-json/runtime/pom.xml +++ b/extensions/logging-json/runtime/pom.xml @@ -28,7 +28,7 @@ org.jboss.logmanager - jboss-logmanager-embedded + jboss-logmanager diff --git a/extensions/panache/panacheql/pom.xml b/extensions/panache/panacheql/pom.xml index d4e631cb17688c..c6ea8652e2334b 100644 --- a/extensions/panache/panacheql/pom.xml +++ b/extensions/panache/panacheql/pom.xml @@ -29,9 +29,9 @@ test - org.jboss.logmanager - jboss-logmanager-embedded - test + org.jboss.logmanager + jboss-logmanager + test diff --git a/extensions/vertx/latebound-mdc-provider/pom.xml b/extensions/vertx/latebound-mdc-provider/pom.xml index 33c15658fdcd34..ac08e7a66b5097 100644 --- a/extensions/vertx/latebound-mdc-provider/pom.xml +++ b/extensions/vertx/latebound-mdc-provider/pom.xml @@ -16,7 +16,7 @@ org.jboss.logmanager - jboss-logmanager-embedded + jboss-logmanager diff --git a/extensions/vertx/latebound-mdc-provider/src/main/java/io/quarkus/vertx/mdc/provider/LateBoundMDCProvider.java b/extensions/vertx/latebound-mdc-provider/src/main/java/io/quarkus/vertx/mdc/provider/LateBoundMDCProvider.java index fa7c36fa9feb1c..4009f8901b70fb 100644 --- a/extensions/vertx/latebound-mdc-provider/src/main/java/io/quarkus/vertx/mdc/provider/LateBoundMDCProvider.java +++ b/extensions/vertx/latebound-mdc-provider/src/main/java/io/quarkus/vertx/mdc/provider/LateBoundMDCProvider.java @@ -119,6 +119,16 @@ public Map copyObject() { return delegate.copyObject(); } + @Override + public boolean isEmpty() { + if (delegate == null) { + Map currentMap = threadLocalMap.get(); + return currentMap == null || currentMap.isEmpty(); + } else { + return delegate.isEmpty(); + } + } + @Override public void clear() { if (delegate == null) { diff --git a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxMDC.java b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxMDC.java index 1f6eb1a800516d..8b8a9a71adae79 100644 --- a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxMDC.java +++ b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxMDC.java @@ -230,6 +230,15 @@ public Map copyObject() { return copyObject(getContext()); } + /** + * Determine whether the current MDC map is empty. + * + * @return {@code true} if there are no bound MDC values, or {@code false} otherwise + */ + public boolean isEmpty() { + return contextualDataMap(getContext()).isEmpty(); + } + /** * Get a copy of the MDC map. This is a relatively expensive operation. * If the informed context is null it falls back to the thread local context map. diff --git a/independent-projects/bootstrap/bom/pom.xml b/independent-projects/bootstrap/bom/pom.xml index 131ccd81e8ff4f..1fac6a9da4c78c 100644 --- a/independent-projects/bootstrap/bom/pom.xml +++ b/independent-projects/bootstrap/bom/pom.xml @@ -411,8 +411,18 @@ org.jboss.logmanager - jboss-logmanager-embedded - ${jboss-logmanager-embedded.version} + jboss-logmanager + ${jboss-logmanager.version} + + + org.jboss.modules + jboss-modules + + + org.eclipse.parsson + jakarta.json + + org.jboss.logging diff --git a/independent-projects/bootstrap/maven-resolver/pom.xml b/independent-projects/bootstrap/maven-resolver/pom.xml index e48e21b6780b37..97ce31340034ce 100644 --- a/independent-projects/bootstrap/maven-resolver/pom.xml +++ b/independent-projects/bootstrap/maven-resolver/pom.xml @@ -57,7 +57,7 @@ org.jboss.logmanager - jboss-logmanager-embedded + jboss-logmanager org.jboss.slf4j diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index 47e1894aef9c5d..df042028bad642 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -68,7 +68,7 @@ 1.0.1 2.8 1.2.6 - 1.0.11 + 3.0.0.Final 1.1.0.Final 1.7.36 23.1.2 diff --git a/independent-projects/bootstrap/runner/pom.xml b/independent-projects/bootstrap/runner/pom.xml index 83406882a2a93d..f32872fa86a749 100644 --- a/independent-projects/bootstrap/runner/pom.xml +++ b/independent-projects/bootstrap/runner/pom.xml @@ -44,7 +44,7 @@ org.jboss.logmanager - jboss-logmanager-embedded + jboss-logmanager org.jboss.logging diff --git a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/EmptyLogContextConfigurator.java b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/EmptyLogContextConfigurator.java new file mode 100644 index 00000000000000..92d026c5a63cea --- /dev/null +++ b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/EmptyLogContextConfigurator.java @@ -0,0 +1,18 @@ +package io.quarkus.bootstrap.logging; + +import java.io.InputStream; + +import org.jboss.logmanager.LogContext; +import org.jboss.logmanager.LogContextConfigurator; + +/** + * An empty log context configuration which prevents the logmanager from configuring itself too early. + */ +public final class EmptyLogContextConfigurator implements LogContextConfigurator { + public EmptyLogContextConfigurator() { + } + + public void configure(final LogContext logContext, final InputStream inputStream) { + // no operation + } +} diff --git a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/InitialConfigurator.java b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/InitialConfigurator.java index d3600f38d1b175..0290906c8d058a 100644 --- a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/InitialConfigurator.java +++ b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/InitialConfigurator.java @@ -3,7 +3,7 @@ import java.util.logging.Handler; import java.util.logging.Level; -import org.jboss.logmanager.EmbeddedConfigurator; +import org.jboss.logmanager.LogContextInitializer; import org.jboss.logmanager.formatters.PatternFormatter; import org.jboss.logmanager.handlers.ConsoleHandler; @@ -12,7 +12,7 @@ /** * */ -public final class InitialConfigurator implements EmbeddedConfigurator { +public final class InitialConfigurator implements LogContextInitializer { public static final QuarkusDelayedHandler DELAYED_HANDLER = new QuarkusDelayedHandler(); private static final Level MIN_LEVEL; @@ -35,17 +35,17 @@ public final class InitialConfigurator implements EmbeddedConfigurator { } @Override - public Level getMinimumLevelOf(final String loggerName) { + public Level getMinimumLevel(final String loggerName) { return MIN_LEVEL; } @Override - public Level getLevelOf(final String loggerName) { + public Level getInitialLevel(final String loggerName) { return loggerName.isEmpty() ? Level.ALL : null; } @Override - public Handler[] getHandlersOf(final String loggerName) { + public Handler[] getInitialHandlers(final String loggerName) { if (loggerName.isEmpty()) { if (ImageInfo.inImageBuildtimeCode()) { // we can't set a cleanup filter without the build items ready @@ -56,10 +56,15 @@ public Handler[] getHandlersOf(final String loggerName) { return new Handler[] { DELAYED_HANDLER }; } } else { - return EmbeddedConfigurator.NO_HANDLERS; + return NO_HANDLERS; } } + @Override + public boolean useStrongReferences() { + return true; + } + public static ConsoleHandler createDefaultHandler() { ConsoleHandler handler = new ConsoleHandler(new PatternFormatter("%d{HH:mm:ss,SSS} %-5p [%c{3.}] %s%e%n")); handler.setLevel(Level.INFO); diff --git a/independent-projects/bootstrap/runner/src/main/resources/META-INF/services/org.jboss.logmanager.LogContextConfigurator b/independent-projects/bootstrap/runner/src/main/resources/META-INF/services/org.jboss.logmanager.LogContextConfigurator new file mode 100644 index 00000000000000..dcac1df565391a --- /dev/null +++ b/independent-projects/bootstrap/runner/src/main/resources/META-INF/services/org.jboss.logmanager.LogContextConfigurator @@ -0,0 +1 @@ +io.quarkus.bootstrap.logging.EmptyLogContextConfigurator \ No newline at end of file diff --git a/independent-projects/bootstrap/runner/src/main/resources/META-INF/services/org.jboss.logmanager.EmbeddedConfigurator b/independent-projects/bootstrap/runner/src/main/resources/META-INF/services/org.jboss.logmanager.LogContextInitializer similarity index 100% rename from independent-projects/bootstrap/runner/src/main/resources/META-INF/services/org.jboss.logmanager.EmbeddedConfigurator rename to independent-projects/bootstrap/runner/src/main/resources/META-INF/services/org.jboss.logmanager.LogContextInitializer diff --git a/independent-projects/enforcer-rules/src/main/resources/enforcer-rules/quarkus-banned-dependencies.xml b/independent-projects/enforcer-rules/src/main/resources/enforcer-rules/quarkus-banned-dependencies.xml index 8b6abc890d419e..9a9654c8ca883c 100644 --- a/independent-projects/enforcer-rules/src/main/resources/enforcer-rules/quarkus-banned-dependencies.xml +++ b/independent-projects/enforcer-rules/src/main/resources/enforcer-rules/quarkus-banned-dependencies.xml @@ -45,7 +45,6 @@ com.sun.activation:jakarta.activation - org.jboss.logging:jboss-logmanager org.jboss.logging:jboss-logging-jdk javax:javaee-api @@ -57,8 +56,6 @@ org.eclipse.parsson:jakarta.json io.netty:netty-all - - org.jboss.logmanager:jboss-logmanager log4j:log4j org.apache.logging.log4j:log4j-core diff --git a/integration-tests/maven/src/test/resources-filtered/projects/classic/pom.xml b/integration-tests/maven/src/test/resources-filtered/projects/classic/pom.xml index 707f07c53d1799..0ff4cfd54da4bd 100644 --- a/integration-tests/maven/src/test/resources-filtered/projects/classic/pom.xml +++ b/integration-tests/maven/src/test/resources-filtered/projects/classic/pom.xml @@ -45,7 +45,7 @@ io.smallrye.common - smallrye-common-cpu + smallrye-common-vertx-context 1.13.2 diff --git a/integration-tests/maven/src/test/resources-filtered/projects/classic/src/main/java/org/acme/ClasspathResources.java b/integration-tests/maven/src/test/resources-filtered/projects/classic/src/main/java/org/acme/ClasspathResources.java index 54ef8909e0b4f0..a8a4efacded055 100644 --- a/integration-tests/maven/src/test/resources-filtered/projects/classic/src/main/java/org/acme/ClasspathResources.java +++ b/integration-tests/maven/src/test/resources-filtered/projects/classic/src/main/java/org/acme/ClasspathResources.java @@ -72,7 +72,7 @@ private String assertMultiRelease() { try { //this class is only present in multi release jars //for fast-jar we need to make sure it is loaded correctly - Class clazz = this.getClass().getClassLoader().loadClass("io.smallrye.common.cpu.ProcessorInfo"); + Class clazz = this.getClass().getClassLoader().loadClass("io.smallrye.common.vertx.VertxContext"); if (clazz.getClassLoader() == getClass().getClassLoader()) { return SUCCESS; } diff --git a/integration-tests/maven/src/test/resources-filtered/projects/rr-with-json-logging/pom.xml b/integration-tests/maven/src/test/resources-filtered/projects/rr-with-json-logging/pom.xml index f1a923ff177131..7095c43cd05739 100644 --- a/integration-tests/maven/src/test/resources-filtered/projects/rr-with-json-logging/pom.xml +++ b/integration-tests/maven/src/test/resources-filtered/projects/rr-with-json-logging/pom.xml @@ -42,7 +42,7 @@ io.smallrye.common - smallrye-common-cpu + smallrye-common-vertx-context 1.13.2 diff --git a/integration-tests/maven/src/test/resources-filtered/projects/rr-with-json-logging/src/main/java/org/acme/ClasspathResources.java b/integration-tests/maven/src/test/resources-filtered/projects/rr-with-json-logging/src/main/java/org/acme/ClasspathResources.java index 62da97eb07a1c2..87a6d6e79488b0 100644 --- a/integration-tests/maven/src/test/resources-filtered/projects/rr-with-json-logging/src/main/java/org/acme/ClasspathResources.java +++ b/integration-tests/maven/src/test/resources-filtered/projects/rr-with-json-logging/src/main/java/org/acme/ClasspathResources.java @@ -72,7 +72,7 @@ private String assertMultiRelease() { try { //this class is only present in multi release jars //for fast-jar we need to make sure it is loaded correctly - Class clazz = this.getClass().getClassLoader().loadClass("io.smallrye.common.cpu.ProcessorInfo"); + Class clazz = this.getClass().getClassLoader().loadClass("io.smallrye.common.vertx.VertxContext"); if (clazz.getClassLoader() == getClass().getClassLoader()) { return SUCCESS; }