feat(common-logging): add support for jboss-logging
Useful to enhance logging support for Wildfly, EAP, Quarkus, etc.
Closes
ADD
common/logging/jboss-logging/pom.xml
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>apiman</artifactId>
+ <groupId>io.apiman</groupId>
+ <version>2.0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>apiman-common-logging-jboss</artifactId>
+ <name>apiman-common-logging-jboss</name>
+ <dependencies>
+ <dependency>
+ <groupId>io.apiman</groupId>
+ <artifactId>apiman-common-logging-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file

ADD
common/logging/jboss-logging/src/main/java/io/apiman/common/logging/jboss/JbossLoggerFactory.java
+/*
+ * Copyright 2021 Scheer PAS Schweiz AG
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.apiman.common.logging.jboss;
+
+import io.apiman.common.logging.IApimanLogger;
+import io.apiman.common.logging.IDelegateFactory;
+import io.apiman.common.logging.annotations.ApimanLoggerFactory;
+
+import org.jboss.logging.Logger;
+
+/**
+ * JBoss Logging logger factory. Useful for platforms like Wildfly, EAP, etc.
+ *
+ * @author Marc Savy {@literal <marc@blackparrotlabs.io>}
+ */
+@ApimanLoggerFactory("jboss-logging")
+public class JbossLoggerFactory implements IDelegateFactory {
+
+ @Override
+ public IApimanLogger createLogger(String name) {
+ return new JbossLoggerImpl(Logger.getLogger(name));
+ }
+
+ @Override
+ public IApimanLogger createLogger(Class<?> klazz) {
+ return new JbossLoggerImpl(Logger.getLogger(klazz));
+ }
+}

ADD
common/logging/jboss-logging/src/main/java/io/apiman/common/logging/jboss/JbossLoggerImpl.java
+/*
+ * Copyright 2021 Scheer PAS Schweiz AG
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.apiman.common.logging.jboss;
+
+import io.apiman.common.logging.IApimanLogger;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Jboss logger facade for ApimanLogger.
+ * <p>
+ * Jboss logger methods ending in <tt>v</tt> use the <tt>MessageFormat</tt>.
+ *
+ * @author Marc Savy {@literal <marc@blackparrotlabs.io>}
+ */
+public class JbossLoggerImpl implements IApimanLogger {
+
+ private final Logger logger;
+
+ /**
+ * New Apiman logger using Jboss Logging underneath
+ * @param logger the new logger instance to delegate to
+ */
+ JbossLoggerImpl(Logger logger) {
+ this.logger = logger;
+ }
+
+ @Override
+ public void info(String message) {
+ logger.info(message);
+ }
+
+ @Override
+ public void info(String message, Object... args) {
+ logger.infov(message, args);
+ }
+
+ @Override
+ public void warn(String message) {
+ logger.warn(message);
+ }
+
+ @Override
+ public void warn(String message, Object... args) {
+ logger.warnv(message, args);
+ }
+
+ @Override
+ public void debug(String message) {
+ logger.debug(message);
+ }
+
+ @Override
+ public void debug(String message, Object... args) {
+ logger.debugv(message, args);
+ }
+
+ @Override
+ public void trace(String message) {
+ logger.trace(message);
+ }
+
+ @Override
+ public void trace(String message, Object... args) {
+ logger.tracev(message, args);
+ }
+
+ @Override
+ public void error(Throwable error) {
+ logger.error(error);
+ }
+
+ @Override
+ public void error(String message, Throwable error) {
+ logger.error(message, error);
+ }
+
+ @Override
+ public void error(Throwable error, String message, Object... args) {
+ logger.errorv(message, message, args);
+ }
+}

MODIFY
common/logging/pom.xml
common/logging/pom.xml
<module>core</module>
<module>slf4j</module>
<module>log4j2</module>
+ <module>jboss-logging</module>
</modules>
</project>

feat(common-logging): add support for jboss-logging

Useful to enhance logging support for Wildfly, EAP, Quarkus, etc.

Closes #1109