Skip to content

Commit

Permalink
Switch to jboss-logmanager
Browse files Browse the repository at this point in the history
Drop the old `jboss-logmanager-embedded` in favor of `jboss-logmanager`.
  • Loading branch information
dmlloyd committed Jul 26, 2023
1 parent 9acf766 commit 1e1c2d0
Show file tree
Hide file tree
Showing 36 changed files with 147 additions and 169 deletions.
27 changes: 10 additions & 17 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
<dekorate.version>3.7.0</dekorate.version> <!-- Please check with Java Operator SDK team before updating -->
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.0</awaitility.version>
<jboss-logmanager.version>1.1.1</jboss-logmanager.version>
<jboss-logmanager.version>3.0.0.Final</jboss-logmanager.version>
<flyway.version>9.21.0</flyway.version>
<yasson.version>3.0.3</yasson.version>
<liquibase.version>4.20.0</liquibase.version>
Expand Down Expand Up @@ -3229,31 +3229,31 @@
<version>${commons-logging-jboss-logging.version}</version>
</dependency>
<dependency>
<!-- NOTE: this dependency exists in order to help users who are using the old GAV for logging -->
<!-- The version doesn't need to be a property since it will be locked at 1.2.0.Final forever -->
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager-embedded</artifactId>
<version>1.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
<version>${jboss-logmanager.version}</version>
<exclusions>
<exclusion>
<groupId>org.jboss.modules</groupId>
<artifactId>jboss-modules</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<groupId>org.eclipse.parsson</groupId>
<artifactId>jakarta.json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>log4j2-jboss-logmanager</artifactId>
<version>${log4j2-jboss-logmanager.version}</version>
<exclusions>
<!-- we use the embedded version -->
<exclusion>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--
While we are not affected by CVE-2021-4428 as we are only using the Log4j2 API,
Expand All @@ -3268,13 +3268,6 @@
<groupId>org.jboss.logmanager</groupId>
<artifactId>log4j-jboss-logmanager</artifactId>
<version>${log4j-jboss-logmanager.version}</version>
<exclusions>
<!-- we use the embedded version -->
<exclusion>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion core/builder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager-embedded</artifactId>
<artifactId>jboss-logmanager</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -210,14 +211,14 @@ void setUpDefaultLogCleanupFilters(List<LogCleanupFilterBuildItem> logCleanupFil

@BuildStep
void miscSetup(
Consumer<RuntimeInitializedClassBuildItem> runtimeInit,
Consumer<RuntimeReinitializedClassBuildItem> runtimeInit,
Consumer<NativeImageSystemPropertyBuildItem> systemProp,
Consumer<ServiceProviderBuildItem> 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
Expand Down
2 changes: 1 addition & 1 deletion core/processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager-embedded</artifactId>
<artifactId>jboss-logmanager</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
24 changes: 18 additions & 6 deletions core/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager-embedded</artifactId>
<artifactId>jboss-logmanager</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
Expand Down Expand Up @@ -148,8 +148,14 @@
</lesserPriorityArtifacts>
<parentFirstArtifacts>
<parentFirstArtifact>io.quarkus:quarkus-bootstrap-runner</parentFirstArtifact>
<parentFirstArtifact>io.smallrye.common:smallrye-common-constraint</parentFirstArtifact>
<parentFirstArtifact>io.smallrye.common:smallrye-common-cpu</parentFirstArtifact>
<parentFirstArtifact>io.smallrye.common:smallrye-common-expression</parentFirstArtifact>
<parentFirstArtifact>io.smallrye.common:smallrye-common-function</parentFirstArtifact>
<parentFirstArtifact>io.smallrye.common:smallrye-common-io</parentFirstArtifact>
<parentFirstArtifact>org.wildfly.common:wildfly-common</parentFirstArtifact>
<parentFirstArtifact>io.smallrye.common:smallrye-common-net</parentFirstArtifact>
<parentFirstArtifact>io.smallrye.common:smallrye-common-os</parentFirstArtifact>
<parentFirstArtifact>io.smallrye.common:smallrye-common-ref</parentFirstArtifact>
<parentFirstArtifact>org.graalvm.sdk:graal-sdk</parentFirstArtifact>
<parentFirstArtifact>org.graalvm.js:js</parentFirstArtifact>
<parentFirstArtifact>org.graalvm.regex:regex</parentFirstArtifact>
Expand All @@ -162,7 +168,7 @@
<parentFirstArtifact>io.quarkus:quarkus-bootstrap-maven-resolver</parentFirstArtifact>
<parentFirstArtifact>org.slf4j:slf4j-api</parentFirstArtifact>
<parentFirstArtifact>org.jboss.slf4j:slf4j-jboss-logmanager</parentFirstArtifact>
<parentFirstArtifact>org.jboss.logmanager:jboss-logmanager-embedded</parentFirstArtifact>
<parentFirstArtifact>org.jboss.logmanager:jboss-logmanager</parentFirstArtifact>
<parentFirstArtifact>org.jboss.logging:jboss-logging</parentFirstArtifact>
<parentFirstArtifact>org.apache.maven:maven-model</parentFirstArtifact>
<parentFirstArtifact>org.apache.maven.resolver:maven-resolver-api</parentFirstArtifact>
Expand Down Expand Up @@ -208,11 +214,17 @@
<runnerParentFirstArtifact>io.quarkus:quarkus-development-mode-spi</runnerParentFirstArtifact>
<!-- logging dependencies always need to be loaded by the JDK ClassLoader -->
<runnerParentFirstArtifact>org.jboss.logging:jboss-logging</runnerParentFirstArtifact>
<runnerParentFirstArtifact>org.jboss.logmanager:jboss-logmanager-embedded</runnerParentFirstArtifact>
<!-- This is needed as it's a dependency of the JBoss Logging so it too needs to be loaded by the JDK ClassLoader -->
<runnerParentFirstArtifact>org.wildfly.common:wildfly-common</runnerParentFirstArtifact>
<runnerParentFirstArtifact>org.jboss.logmanager:jboss-logmanager</runnerParentFirstArtifact>
<!-- These are needed as it's a dependency of the JBoss LogManager so it too needs to be loaded by the JDK ClassLoader -->
<runnerParentFirstArtifact>io.smallrye.common:smallrye-common-constraint</runnerParentFirstArtifact>
<runnerParentFirstArtifact>io.smallrye.common:smallrye-common-cpu</runnerParentFirstArtifact>
<runnerParentFirstArtifact>io.smallrye.common:smallrye-common-expression</runnerParentFirstArtifact>
<runnerParentFirstArtifact>io.smallrye.common:smallrye-common-function</runnerParentFirstArtifact>
<!-- This is needed because it contains some jar handling classes -->
<runnerParentFirstArtifact>io.smallrye.common:smallrye-common-io</runnerParentFirstArtifact>
<runnerParentFirstArtifact>io.smallrye.common:smallrye-common-net</runnerParentFirstArtifact>
<runnerParentFirstArtifact>io.smallrye.common:smallrye-common-os</runnerParentFirstArtifact>
<runnerParentFirstArtifact>io.smallrye.common:smallrye-common-ref</runnerParentFirstArtifact>
<!-- QuarkusEntryPoint needs org-crac class definition -->
<runnerParentFirstArtifact>io.github.crac:org-crac</runnerParentFirstArtifact>
<!-- Make use of byteman frictionless -->
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -21,8 +21,8 @@
final class Target_org_jboss_logmanager_LoggerNode {

@Alias
@RecomputeFieldValue(declClass = AtomicReference.class, kind = RecomputeFieldValue.Kind.NewInstance)
AtomicReference<Handler[]> handlersRef;
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias)
Handler[] handlers = LogContextInitializer.NO_HANDLERS;
}

@TargetClass(className = "org.slf4j.LoggerFactory")
Expand All @@ -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();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/class-loading-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ or a `LinkageError` can occur.
<parentFirstArtifacts>
<parentFirstArtifact>io.quarkus:quarkus-bootstrap-core</parentFirstArtifact>
<parentFirstArtifact>io.quarkus:quarkus-development-mode-spi</parentFirstArtifact>
<parentFirstArtifact>org.jboss.logmanager:jboss-logmanager-embedded</parentFirstArtifact>
<parentFirstArtifact>org.jboss.logmanager:jboss-logmanager</parentFirstArtifact>
<parentFirstArtifact>org.jboss.logging:jboss-logging</parentFirstArtifact>
<parentFirstArtifact>org.ow2.asm:asm</parentFirstArtifact>
</parentFirstArtifacts>
Expand Down
4 changes: 2 additions & 2 deletions extensions/datasource/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager-embedded</artifactId>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions extensions/devservices/db2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager-embedded</artifactId>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions extensions/devservices/derby/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager-embedded</artifactId>
<scope>test</scope>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
Expand Down
Loading

0 comments on commit 1e1c2d0

Please sign in to comment.