From cf6c2cd81ee259729cd53b482b8d95488bb70f97 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 15 Jan 2025 14:37:03 +0200 Subject: [PATCH] Use VertxLogDelegateFactory for internal Vert.x logging This is done because I assume that was the original intent, but also because it avoids the non-zero cost incurred by Vert.x to look up the various supported options --- .../vertx/core/deployment/VertxCoreProcessor.java | 6 ++++++ .../io/quarkus/vertx/core/runtime/VertxCoreRecorder.java | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/core/deployment/VertxCoreProcessor.java b/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/core/deployment/VertxCoreProcessor.java index 41acd5fe59f51..0feaf4c912316 100644 --- a/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/core/deployment/VertxCoreProcessor.java +++ b/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/core/deployment/VertxCoreProcessor.java @@ -220,6 +220,12 @@ IOThreadDetectorBuildItem ioThreadDetector(VertxCoreRecorder recorder) { return new IOThreadDetectorBuildItem(recorder.detector()); } + @BuildStep + @Record(ExecutionTime.RUNTIME_INIT) + void configureLogging(VertxCoreRecorder recorder) { + recorder.configureQuarkusLoggerFactory(); + } + @BuildStep @Produce(ServiceStartBuildItem.class) @Record(value = ExecutionTime.RUNTIME_INIT) diff --git a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java index 15ab4cd34fc98..80fcfc52ce597 100644 --- a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java +++ b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java @@ -69,6 +69,8 @@ @Recorder public class VertxCoreRecorder { + private static final String LOGGER_FACTORY_NAME_SYS_PROP = "vertx.logger-delegate-factory-class-name"; + static { System.setProperty("vertx.disableTCCL", "true"); } @@ -667,6 +669,13 @@ public static Supplier recoverFailedStart(VertxConfiguration config, Thre } + public void configureQuarkusLoggerFactory() { + String loggerClassName = System.getProperty(LOGGER_FACTORY_NAME_SYS_PROP); + if (loggerClassName == null) { + System.setProperty(LOGGER_FACTORY_NAME_SYS_PROP, VertxLogDelegateFactory.class.getName()); + } + } + static class VertxSupplier implements Supplier { final LaunchMode launchMode; final VertxConfiguration config;