You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/05/10 16:03:24 UTC
[activemq-artemis] 05/19: moving some stuff
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch new-logging
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit d053c2e13064af7839d726f707e4496e71853b39
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Tue May 3 00:10:24 2022 -0400
moving some stuff
---
artemis-commons/pom.xml | 1 +
.../core/server/ActiveMQScheduledComponent.java | 5 +-
.../artemis/core/server/NetworkHealthCheck.java | 5 +-
.../activemq/artemis/logprocessor/CodeFactory.java | 54 +++++
.../artemis/logprocessor/LogProcessor.java | 236 +++++++++++++++++++++
.../logprocessor/annotation/ArtemisBundle.java | 30 +++
.../artemis/logprocessor/annotation/Cause.java | 30 +++
.../logprocessor/annotation/LogMessage.java | 33 +++
.../artemis/logprocessor/annotation/Message.java | 33 +++
.../activemq/artemis/logs/ActiveMQUtilLogger.java | 127 ++++-------
.../apache/activemq/artemis/logs/AuditLogger.java | 3 +-
.../logs/JBossLoggingApacheLoggerBridge.java | 7 +-
.../apache/activemq/artemis/utils/ByteUtil.java | 3 +-
.../activemq/artemis/utils/ClassloadingUtil.java | 5 +-
.../artemis/utils/DefaultSensitiveStringCodec.java | 5 +-
.../activemq/artemis/utils/SizeAwareMetric.java | 5 +-
.../activemq/artemis/utils/SpawnedVMSupport.java | 5 +-
.../artemis/utils/actors/OrderedExecutor.java | 5 +-
.../artemis/utils/actors/ProcessorBase.java | 5 +-
.../artemis/utils/actors/ThresholdActor.java | 5 +-
.../utils/collections/ConcurrentLongHashSet.java | 5 +-
.../utils/critical/CriticalAnalyzerImpl.java | 5 +-
.../artemis/utils/critical/CriticalMeasure.java | 5 +-
.../FluentPropertyBeanIntrospectorWithIgnores.java | 5 +-
.../services/javax.annotation.processing.Processor | 1 +
.../artemis/logprocessor/SimpleBundle.java | 46 ++++
.../artemis/logprocessor/SimpleBundleTest.java | 57 +++++
.../activemq/artemis/utils/ByteUtilTest.java | 5 +-
.../artemis/utils/CleanupSystemPropertiesRule.java | 5 +-
.../utils/DefaultSensitiveStringCodecTest.java | 5 +-
.../apache/activemq/artemis/utils/ExecuteUtil.java | 5 +-
.../apache/activemq/artemis/utils/RetryRule.java | 5 +-
.../artemis/utils/ThreadLeakCheckRule.java | 5 +-
.../utils/actors/OrderedExecutorSanityTest.java | 5 +-
.../critical/MultiThreadCriticalMeasureTest.java | 5 +-
pom.xml | 2 +-
36 files changed, 637 insertions(+), 131 deletions(-)
diff --git a/artemis-commons/pom.xml b/artemis-commons/pom.xml
index ac5c9135da..9eb377ba99 100644
--- a/artemis-commons/pom.xml
+++ b/artemis-commons/pom.xml
@@ -55,6 +55,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
+ <!-- License: MIT -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQScheduledComponent.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQScheduledComponent.java
index 6783f7a672..c15f73cbfc 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQScheduledComponent.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQScheduledComponent.java
@@ -28,14 +28,15 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This is for components with a scheduled at a fixed rate.
*/
public abstract class ActiveMQScheduledComponent implements ActiveMQComponent, Runnable {
- private static final Logger logger = Logger.getLogger(ActiveMQScheduledComponent.class);
+ private static final Logger logger = LoggerFactory.getLogger(ActiveMQScheduledComponent.class);
protected ScheduledExecutorService scheduledExecutorService;
private boolean startedOwnScheduler;
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
index 535ff61598..80146c8fc8 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
@@ -35,7 +35,8 @@ import org.apache.activemq.artemis.logs.ActiveMQUtilLogger;
import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.apache.activemq.artemis.utils.Env;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This will use {@link InetAddress#isReachable(int)} to determine if the network is alive.
@@ -43,7 +44,7 @@ import org.jboss.logging.Logger;
*/
public class NetworkHealthCheck extends ActiveMQScheduledComponent {
- private static final Logger logger = Logger.getLogger(NetworkHealthCheck.class);
+ private static final Logger logger = LoggerFactory.getLogger(NetworkHealthCheck.class);
private final Set<ActiveMQComponent> componentList = new ConcurrentHashSet<>();
private final Set<String> addresses = new ConcurrentHashSet<>();
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/CodeFactory.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/CodeFactory.java
new file mode 100644
index 0000000000..46bbba1935
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/CodeFactory.java
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.activemq.artemis.logprocessor;
+
+import java.lang.reflect.Field;
+import java.security.PrivilegedAction;
+
+import static java.security.AccessController.doPrivileged;
+
+public class CodeFactory {
+
+ public static <T> T getBundle(final Class<T> type) {
+ return doPrivileged(new PrivilegedAction<T>() {
+ public T run() {
+ try {
+ String className = type.getName() + "_impl";
+ System.out.println("Loading [" + className + "]");
+ Class messageClass = Class.forName(className, true, type.getClassLoader()).asSubclass(type);
+
+ Field field = messageClass.getField("INSTANCE");
+
+ return type.cast(field.get(null));
+ } catch (ClassNotFoundException e) {
+ return null;
+ } catch (NoSuchFieldException e) {
+ throw new IllegalStateException(e.getMessage(), e);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ throw new IllegalStateException(e.getMessage(), e);
+ }
+ }
+ });
+ }
+
+ public static <T> T getMessageLogger(Class<T> type) {
+ return getBundle(type);
+ }
+
+}
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java
new file mode 100644
index 0000000000..67241ad436
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java
@@ -0,0 +1,236 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.activemq.artemis.logprocessor;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.tools.Diagnostic;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.activemq.artemis.logprocessor.annotation.ArtemisBundle;
+import org.apache.activemq.artemis.logprocessor.annotation.LogMessage;
+import org.apache.activemq.artemis.logprocessor.annotation.Message;
+
+@SupportedAnnotationTypes({"org.apache.activemq.artemis.logprocessor.annotation.ArtemisBundle"})
+public class LogProcessor extends AbstractProcessor {
+
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ HashMap<Integer, String> messages = new HashMap<>();
+
+ try {
+
+ System.out.println("*******************************************************************************************************************************");
+ for (TypeElement e : annotations) {
+ System.out.println("e::" + e);
+ for (Element annotatedTypeEl : roundEnv.getElementsAnnotatedWith(e)) {
+ System.out.println("annotated::" + annotatedTypeEl);
+ }
+ }
+ System.out.println("*******************************************************************************************************************************");
+
+ for (TypeElement annotation : annotations) {
+ System.out.println("Annotation: " + annotation);
+ for (Element annotatedTypeEl : roundEnv.getElementsAnnotatedWith(annotation)) {
+
+ TypeElement annotatedType = (TypeElement) annotatedTypeEl;
+
+ ArtemisBundle bundleAnnotation = annotatedType.getAnnotation(ArtemisBundle.class);
+
+ String fullClassName = annotatedType.getQualifiedName() + "_impl";
+ String interfaceName = annotatedType.getSimpleName().toString();
+ String simpleClassName = interfaceName + "_impl";
+ PrintWriter writerOutput = new PrintWriter(processingEnv.getFiler().createSourceFile(fullClassName).openWriter());
+
+ // header
+ writerOutput.println("/** This class is auto generated by " + LogProcessor.class.getCanonicalName());
+ writerOutput.println(" and it inherits whatever license is declared at " + annotatedType + " */");
+ writerOutput.println();
+
+ // opening package
+ writerOutput.println("package " + annotatedType.getEnclosingElement() + ";");
+ writerOutput.println();
+
+ // Opening class
+ writerOutput.println("// " + bundleAnnotation.toString());
+ writerOutput.println("public class " + simpleClassName + " implements " + interfaceName);
+ writerOutput.println("{");
+
+ // Declaring the static field that's used by {@link I18NFactory}
+ writerOutput.println(" public static " + simpleClassName + " INSTANCE = new " + simpleClassName + "();");
+ writerOutput.println();
+
+ for (Element el : annotatedType.getEnclosedElements()) {
+ if (el.getKind() == ElementKind.METHOD) {
+
+ ExecutableElement executableMember = (ExecutableElement) el;
+
+ Message messageAnnotation = el.getAnnotation(Message.class);
+ LogMessage logAnnotation = el.getAnnotation(LogMessage.class);
+ if (messageAnnotation != null && logAnnotation != null) {
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Can't use both Message and Log at a method at " + el);
+ return false;
+ }
+
+ if (messageAnnotation != null) {
+ generateMessage(bundleAnnotation, writerOutput, executableMember, messageAnnotation, messages);
+ } else if (logAnnotation != null) {
+ generateLogger(bundleAnnotation, writerOutput, executableMember, logAnnotation, messages);
+ } else {
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Annotation not found at " + el);
+ return false;
+ }
+
+ }
+ }
+
+ writerOutput.println("}");
+
+ writerOutput.close();
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, e.getMessage());
+ return false;
+ }
+
+ return true;
+ }
+
+ private void generateMessage(ArtemisBundle bundleAnnotation,
+ PrintWriter writerOutput,
+ ExecutableElement executableMember,
+ Message messageAnnotation,
+ HashMap<Integer, String> processedMessages) {
+
+ String previousMessage = processedMessages.get(messageAnnotation.id());
+
+ if (processedMessages.containsKey(messageAnnotation.id())) {
+ throw new IllegalStateException("message " + messageAnnotation.id() + " with definition = " + messageAnnotation.value() + " was previously defined as " + previousMessage);
+ }
+
+ processedMessages.put(messageAnnotation.id(), messageAnnotation.value());
+
+ // This is really a debug output
+ writerOutput.println(" // " + messageAnnotation.toString());
+
+ writerOutput.write(" public " + executableMember.getReturnType() + " " + executableMember.getSimpleName() + "(");
+
+ Iterator<? extends VariableElement> parameters = executableMember.getParameters().iterator();
+
+ boolean hasParameters = false;
+
+ // the one that will be used on the call
+ StringBuffer callList = new StringBuffer();
+ while (parameters.hasNext()) {
+ hasParameters = true;
+ VariableElement parameter = parameters.next();
+ writerOutput.write(parameter.asType() + " " + parameter.getSimpleName());
+ callList.append(parameter.getSimpleName());
+ if (parameters.hasNext()) {
+ writerOutput.write(", ");
+ callList.append(",");
+ }
+ }
+
+ // the real implementation
+ writerOutput.println(")");
+ writerOutput.println(" {");
+
+ String formattingString = bundleAnnotation.projectCode() + messageAnnotation.id() + " " + messageAnnotation.value();
+ if (!hasParameters) {
+ writerOutput.println(" String returnString = \"" + formattingString + "\";");
+ } else {
+ writerOutput.println(" String returnString = java.text.MessageFormat.format(\"" + formattingString + "\"," + callList + ");");
+ }
+
+ if (executableMember.getReturnType().toString().equals(String.class.getName())) {
+ writerOutput.println(" return returnString;");
+ } else {
+ writerOutput.println(" return new " + executableMember.getReturnType().toString() + "(returnString);");
+ }
+
+ writerOutput.println(" }");
+ writerOutput.println();
+ }
+
+ private void generateLogger(ArtemisBundle bundleAnnotation,
+ PrintWriter writerOutput,
+ ExecutableElement executableMember,
+ LogMessage messageAnnotation,
+ HashMap<Integer, String> processedMessages) {
+
+ String previousMessage = processedMessages.get(messageAnnotation.id());
+
+ if (processedMessages.containsKey(messageAnnotation.id())) {
+ throw new IllegalStateException("message " + messageAnnotation.id() + " with definition = " + messageAnnotation.value() + " was previously defined as " + previousMessage);
+ }
+
+ processedMessages.put(messageAnnotation.id(), messageAnnotation.value());
+
+ // This is really a debug output
+ writerOutput.println(" // " + messageAnnotation.toString());
+
+ writerOutput.write(" public void " + executableMember.getSimpleName() + "(");
+
+ Iterator<? extends VariableElement> parameters = executableMember.getParameters().iterator();
+
+ boolean hasParameters = false;
+
+ // the one that will be used on the call
+ StringBuffer callList = new StringBuffer();
+ while (parameters.hasNext()) {
+ hasParameters = true;
+ VariableElement parameter = parameters.next();
+ writerOutput.write(parameter.asType() + " " + parameter.getSimpleName());
+ callList.append(parameter.getSimpleName());
+ if (parameters.hasNext()) {
+ writerOutput.write(", ");
+ callList.append(",");
+ }
+ }
+
+ // the real implementation
+ writerOutput.println(")");
+ writerOutput.println(" {");
+
+ String formattingString = bundleAnnotation.projectCode() + messageAnnotation.id() + " " + messageAnnotation.value();
+ if (!hasParameters) {
+ writerOutput.println(" String messageString = \"" + formattingString + "\";");
+ } else {
+ writerOutput.println(" String messageString = java.text.MessageFormat.format(\"" + formattingString + "\"," + callList + ");");
+ }
+
+ writerOutput.println(" // TODO: We should use the logger instead of a System.out of course");
+ writerOutput.println(" System.out.println(messageString);");
+
+ writerOutput.println(" }");
+ writerOutput.println();
+ }
+}
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/ArtemisBundle.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/ArtemisBundle.java
new file mode 100644
index 0000000000..5d7aaf8d55
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/ArtemisBundle.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.activemq.artemis.logprocessor.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.SOURCE)
+public @interface ArtemisBundle {
+
+ String projectCode();
+}
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/Cause.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/Cause.java
new file mode 100644
index 0000000000..a0751d402e
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/Cause.java
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.activemq.artemis.logprocessor.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.PARAMETER;
+
+@Target(PARAMETER)
+@Retention(RetentionPolicy.SOURCE)
+public @interface Cause {
+
+}
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/LogMessage.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/LogMessage.java
new file mode 100644
index 0000000000..bcaee8a093
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/LogMessage.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.activemq.artemis.logprocessor.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface LogMessage {
+
+ int id();
+
+ String value();
+
+}
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/Message.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/Message.java
new file mode 100644
index 0000000000..8cc2b60935
--- /dev/null
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logprocessor/annotation/Message.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.activemq.artemis.logprocessor.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface Message {
+
+ int id();
+
+ String value();
+
+}
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/ActiveMQUtilLogger.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/ActiveMQUtilLogger.java
index 502daffdbd..834fbc1c30 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/ActiveMQUtilLogger.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/ActiveMQUtilLogger.java
@@ -16,12 +16,11 @@
*/
package org.apache.activemq.artemis.logs;
-import org.jboss.logging.BasicLogger;
-import org.jboss.logging.Logger;
-import org.jboss.logging.annotations.Cause;
-import org.jboss.logging.annotations.LogMessage;
-import org.jboss.logging.annotations.Message;
-import org.jboss.logging.annotations.MessageLogger;
+import org.apache.activemq.artemis.logprocessor.CodeFactory;
+import org.apache.activemq.artemis.logprocessor.annotation.ArtemisBundle;
+import org.apache.activemq.artemis.logprocessor.annotation.LogMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Logger Code 20
@@ -37,106 +36,68 @@ import org.jboss.logging.annotations.MessageLogger;
*
* so an INFO message would be 201000 to 201999
*/
-@MessageLogger(projectCode = "AMQ")
-public interface ActiveMQUtilLogger extends BasicLogger {
+@ArtemisBundle(projectCode = "AMQ")
+public interface ActiveMQUtilLogger {
/**
* The default logger.
*/
- ActiveMQUtilLogger LOGGER = Logger.getMessageLogger(ActiveMQUtilLogger.class, ActiveMQUtilLogger.class.getPackage().getName());
+ ActiveMQUtilLogger LOGGER = CodeFactory.getMessageLogger(ActiveMQUtilLogger.class);
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 201000, value = "Network is healthy, starting service {0}",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 201000, value = "Network is healthy, starting service {0}")
void startingService(String component);
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 201001, value = "Network is unhealthy, stopping service {0}",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 201001, value = "Network is unhealthy, stopping service {0}")
void stoppingService(String component);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202000, value = "Missing privileges to set Thread Context Class Loader on Thread Factory. Using current Thread Context Class Loader",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 202000, value = "Missing privileges to set Thread Context Class Loader on Thread Factory. Using current Thread Context Class Loader")
void missingPrivsForClassloader();
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202001, value = "{0} is a loopback address and will be discarded.",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 202001, value = "{0} is a loopback address and will be discarded.")
void addressloopback(String address);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202002, value = "Ping Address {0} wasn't reacheable.",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 202002, value = "Ping Address {0} wasn't reacheable.")
void addressWasntReacheable(String address);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202003, value = "Ping Url {0} wasn't reacheable.",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 202003, value = "Ping Url {0} wasn't reacheable.")
void urlWasntReacheable(String url);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202004, value = "Error starting component {0} ",
- format = Message.Format.MESSAGE_FORMAT)
- void errorStartingComponent(@Cause Exception e, String component);
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202005, value = "Error stopping component {0} ",
- format = Message.Format.MESSAGE_FORMAT)
- void errorStoppingComponent(@Cause Exception e, String component);
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202006, value = "Failed to check Url {0}.",
- format = Message.Format.MESSAGE_FORMAT)
- void failedToCheckURL(@Cause Exception e, String url);
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202007, value = "Failed to check Address {0}.",
- format = Message.Format.MESSAGE_FORMAT)
- void failedToCheckAddress(@Cause Exception e, String address);
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202008, value = "Failed to check Address list {0}.",
- format = Message.Format.MESSAGE_FORMAT)
- void failedToParseAddressList(@Cause Exception e, String addressList);
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202009, value = "Failed to check Url list {0}.",
- format = Message.Format.MESSAGE_FORMAT)
- void failedToParseUrlList(@Cause Exception e, String urlList);
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202010, value = "Failed to set NIC {0}.",
- format = Message.Format.MESSAGE_FORMAT)
- void failedToSetNIC(@Cause Exception e, String nic);
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202011, value = "Failed to read from stream {0}.",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 202004, value = "Error starting component {0} ")
+ void errorStartingComponent(Exception e, String component);
+
+ @LogMessage(id = 202005, value = "Error stopping component {0} ")
+ void errorStoppingComponent(Exception e, String component);
+
+ @LogMessage(id = 202006, value = "Failed to check Url {0}.")
+ void failedToCheckURL(Exception e, String url);
+
+ @LogMessage(id = 202007, value = "Failed to check Address {0}.")
+ void failedToCheckAddress(Exception e, String address);
+
+ @LogMessage(id = 202008, value = "Failed to check Address list {0}.")
+ void failedToParseAddressList(Exception e, String addressList);
+
+ @LogMessage(id = 202009, value = "Failed to check Url list {0}.")
+ void failedToParseUrlList(Exception e, String urlList);
+
+ @LogMessage(id = 202010, value = "Failed to set NIC {0}.")
+ void failedToSetNIC(Exception e, String nic);
+
+ @LogMessage(id = 202011, value = "Failed to read from stream {0}.")
void failedToReadFromStream(String stream);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202012, value = "Object cannot be serialized.",
- format = Message.Format.MESSAGE_FORMAT)
- void failedToSerializeObject(@Cause Exception e);
+ @LogMessage(id = 202012, value = "Object cannot be serialized.")
+ void failedToSerializeObject(Exception e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202013, value = "Unable to deserialize object.",
- format = Message.Format.MESSAGE_FORMAT)
- void failedToDeserializeObject(@Cause Exception e);
+ @LogMessage(id = 202013, value = "Unable to deserialize object.")
+ void failedToDeserializeObject(Exception e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202014, value = "Unable to encode byte array into Base64 notation.",
- format = Message.Format.MESSAGE_FORMAT)
- void failedToEncodeByteArrayToBase64Notation(@Cause Exception e);
+ @LogMessage(id = 202014, value = "Unable to encode byte array into Base64 notation.")
+ void failedToEncodeByteArrayToBase64Notation(Exception e);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202015, value = "Failed to clean up file {0}",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 202015, value = "Failed to clean up file {0}")
void failedToCleanupFile(String file);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 202016, value = "Could not list files to clean up in {0}",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 202016, value = "Could not list files to clean up in {0}")
void failedListFilesToCleanup(String path);
}
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AuditLogger.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AuditLogger.java
index d654e9f813..71ac6e3d1e 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AuditLogger.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/AuditLogger.java
@@ -17,7 +17,8 @@
package org.apache.activemq.artemis.logs;
import org.jboss.logging.BasicLogger;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/JBossLoggingApacheLoggerBridge.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/JBossLoggingApacheLoggerBridge.java
index 78242a2572..f53f0a613f 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/JBossLoggingApacheLoggerBridge.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/logs/JBossLoggingApacheLoggerBridge.java
@@ -18,7 +18,8 @@
package org.apache.activemq.artemis.logs;
import org.apache.commons.logging.Log;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* There is an issue on the Testsuite, as it's not possible
@@ -35,11 +36,11 @@ public class JBossLoggingApacheLoggerBridge implements Log {
final Logger bridgeLog;
public JBossLoggingApacheLoggerBridge(Class clazz) {
- bridgeLog = Logger.getLogger(clazz);
+ bridgeLog = LoggerFactory.getLogger(clazz);
}
public JBossLoggingApacheLoggerBridge(String name) {
- bridgeLog = Logger.getLogger(name);
+ bridgeLog = LoggerFactory.getLogger(name);
}
@Override
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ByteUtil.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ByteUtil.java
index 8c5fec9e6d..30ec43ae0b 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ByteUtil.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ByteUtil.java
@@ -29,7 +29,8 @@ import io.netty.util.internal.PlatformDependent;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.logs.ActiveMQUtilBundle;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ByteUtil {
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ClassloadingUtil.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ClassloadingUtil.java
index b56e3a09b8..c1febd38f3 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ClassloadingUtil.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ClassloadingUtil.java
@@ -19,7 +19,8 @@ package org.apache.activemq.artemis.utils;
import java.net.URL;
import java.util.Properties;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This class will be used to perform generic class-loader operations,
@@ -30,7 +31,7 @@ import org.jboss.logging.Logger;
public final class ClassloadingUtil {
- private static final Logger logger = Logger.getLogger(ClassloadingUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(ClassloadingUtil.class);
private static final String INSTANTIATION_EXCEPTION_MESSAGE = "Your class must have a constructor without arguments. If it is an inner class, it must be static!";
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodec.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodec.java
index 6f07a7b80b..6e36488e69 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodec.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodec.java
@@ -31,7 +31,8 @@ import java.util.Map;
import java.util.Objects;
import java.util.Properties;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A DefaultSensitiveDataCodec
@@ -47,7 +48,7 @@ import org.jboss.logging.Logger;
*/
public class DefaultSensitiveStringCodec implements SensitiveDataCodec<String> {
- private static final Logger logger = Logger.getLogger(DefaultSensitiveStringCodec.class);
+ private static final Logger logger = LoggerFactory.getLogger(DefaultSensitiveStringCodec.class);
public static final String ALGORITHM = "algorithm";
public static final String BLOWFISH_KEY = "key";
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SizeAwareMetric.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SizeAwareMetric.java
index 22c8b98385..45c2c20029 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SizeAwareMetric.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SizeAwareMetric.java
@@ -20,7 +20,8 @@ package org.apache.activemq.artemis.utils;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class SizeAwareMetric {
@@ -28,7 +29,7 @@ public class SizeAwareMetric {
void add(int delta, boolean sizeOnly);
}
- private static final Logger logger = Logger.getLogger(SizeAwareMetric.class);
+ private static final Logger logger = LoggerFactory.getLogger(SizeAwareMetric.class);
private static final int PENDING_FREE = 0, FREE = 1, PENDING_OVER_SIZE = 2, OVER_SIZE = 3, PENDING_OVER_ELEMENTS = 4, OVER_ELEMENTS = 5, NOT_USED = -1;
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java
index e71c57ffcb..87548fc150 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/SpawnedVMSupport.java
@@ -27,13 +27,14 @@ import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class SpawnedVMSupport {
static ConcurrentHashMap<Process, String> startedProcesses = null;
- private static final Logger log = Logger.getLogger(SpawnedVMSupport.class);
+ private static final Logger log = LoggerFactory.getLogger(SpawnedVMSupport.class);
public static Process spawnVM(final String className, final String... args) throws Exception {
return SpawnedVMSupport.spawnVM(className, new String[0], true, args);
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/OrderedExecutor.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/OrderedExecutor.java
index 8a02497b00..b941f59d20 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/OrderedExecutor.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/OrderedExecutor.java
@@ -20,7 +20,8 @@ package org.apache.activemq.artemis.utils.actors;
import java.util.concurrent.Executor;
import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* An executor that always runs all tasks in order, using a delegate executor to run the tasks.
@@ -34,7 +35,7 @@ public class OrderedExecutor extends ProcessorBase<Runnable> implements ArtemisE
super(delegate);
}
- private static final Logger logger = Logger.getLogger(OrderedExecutor.class);
+ private static final Logger logger = LoggerFactory.getLogger(OrderedExecutor.class);
@Override
protected final void doTask(Runnable task) {
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ProcessorBase.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ProcessorBase.java
index 67dcb5cdb3..850330a971 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ProcessorBase.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ProcessorBase.java
@@ -24,11 +24,12 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.function.Consumer;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public abstract class ProcessorBase<T> extends HandlerBase {
- private static final Logger logger = Logger.getLogger(ProcessorBase.class);
+ private static final Logger logger = LoggerFactory.getLogger(ProcessorBase.class);
public static final int STATE_NOT_RUNNING = 0;
public static final int STATE_RUNNING = 1;
public static final int STATE_FORCED_SHUTDOWN = 2;
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ThresholdActor.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ThresholdActor.java
index 6b00b87179..21e1e33b94 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ThresholdActor.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ThresholdActor.java
@@ -21,11 +21,12 @@ import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.function.ToIntFunction;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ThresholdActor<T> extends ProcessorBase<Object> {
- private static final Logger logger = Logger.getLogger(ThresholdActor.class);
+ private static final Logger logger = LoggerFactory.getLogger(ThresholdActor.class);
private static final AtomicIntegerFieldUpdater<ThresholdActor> SIZE_UPDATER = AtomicIntegerFieldUpdater.newUpdater(ThresholdActor.class, "size");
private volatile int size = 0;
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSet.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSet.java
index 4188524cf4..cf1fb60edb 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSet.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentLongHashSet.java
@@ -26,7 +26,8 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.locks.StampedLock;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import static org.apache.activemq.artemis.utils.Preconditions.checkArgument;
@@ -40,7 +41,7 @@ import static org.apache.activemq.artemis.utils.Preconditions.checkArgument;
*/
public class ConcurrentLongHashSet {
- private static final Logger logger = Logger.getLogger(ConcurrentLongHashSet.class);
+ private static final Logger logger = LoggerFactory.getLogger(ConcurrentLongHashSet.class);
private static final long EmptyItem = -1L;
private static final long DeletedItem = -2L;
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/critical/CriticalAnalyzerImpl.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/critical/CriticalAnalyzerImpl.java
index 528d15f488..e7363bd771 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/critical/CriticalAnalyzerImpl.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/critical/CriticalAnalyzerImpl.java
@@ -24,11 +24,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class CriticalAnalyzerImpl implements CriticalAnalyzer {
- private final Logger logger = Logger.getLogger(CriticalAnalyzer.class);
+ private final Logger logger = LoggerFactory.getLogger(CriticalAnalyzer.class);
private volatile long timeoutNanoSeconds;
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/critical/CriticalMeasure.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/critical/CriticalMeasure.java
index 16fa099dc5..292808db1d 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/critical/CriticalMeasure.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/critical/CriticalMeasure.java
@@ -20,7 +20,8 @@ package org.apache.activemq.artemis.utils.critical;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import org.apache.activemq.artemis.utils.ArtemisCloseable;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class CriticalMeasure {
@@ -28,7 +29,7 @@ public class CriticalMeasure {
return closeable == dummyCloseable;
}
- private static final Logger logger = Logger.getLogger(CriticalMeasure.class);
+ private static final Logger logger = LoggerFactory.getLogger(CriticalMeasure.class);
// this is used on enterCritical, if the logger is in trace mode
private volatile Exception traceEnter;
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/FluentPropertyBeanIntrospectorWithIgnores.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/FluentPropertyBeanIntrospectorWithIgnores.java
index ad56353eef..cd88b7aa26 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/FluentPropertyBeanIntrospectorWithIgnores.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/FluentPropertyBeanIntrospectorWithIgnores.java
@@ -26,11 +26,12 @@ import org.apache.activemq.artemis.api.core.Pair;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.commons.beanutils.FluentPropertyBeanIntrospector;
import org.apache.commons.beanutils.IntrospectionContext;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class FluentPropertyBeanIntrospectorWithIgnores extends FluentPropertyBeanIntrospector {
- static Logger logger = Logger.getLogger(FluentPropertyBeanIntrospectorWithIgnores.class);
+ static Logger logger = LoggerFactory.getLogger(FluentPropertyBeanIntrospectorWithIgnores.class);
private static ConcurrentHashSet<Pair<String, String>> ignores = new ConcurrentHashSet<>();
diff --git a/artemis-commons/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/artemis-commons/src/main/resources/META-INF/services/javax.annotation.processing.Processor
new file mode 100644
index 0000000000..f3a45cc405
--- /dev/null
+++ b/artemis-commons/src/main/resources/META-INF/services/javax.annotation.processing.Processor
@@ -0,0 +1 @@
+org.apache.activemq.artemis.logprocessor.LogProcessor
\ No newline at end of file
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java
new file mode 100644
index 0000000000..af95833971
--- /dev/null
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.activemq.artemis.logprocessor;
+
+import org.apache.activemq.artemis.logprocessor.annotation.ArtemisBundle;
+import org.apache.activemq.artemis.logprocessor.annotation.LogMessage;
+import org.apache.activemq.artemis.logprocessor.annotation.Message;
+
+@ArtemisBundle(projectCode = "TST")
+public interface SimpleBundle {
+
+ SimpleBundle MESSAGES = CodeFactory.getBundle(SimpleBundle.class);
+
+ @Message(id = 1, value = "Test")
+ String simpleTest();
+
+ @Message(id = 2, value = "V{0}-{1}")
+ String parameters(int value, String value2);
+
+ @Message(id = 3, value = "EX")
+ Exception someException();
+
+ @Message(id = 4, value = "EX-{0}")
+ Exception someExceptionParameter(String parameter);
+
+ @LogMessage(id = 5, value = "This is a print!!!")
+ void printMessage();
+
+ @LogMessage(id = 6, value = "This is a print!!! {0}")
+ void printMessage(int nr);
+}
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java
new file mode 100644
index 0000000000..69afc1951a
--- /dev/null
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.activemq.artemis.logprocessor;
+
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SimpleBundleTest {
+
+ @Test
+ public void testSimple() {
+ Assert.assertEquals("TST1 Test", SimpleBundle.MESSAGES.simpleTest());
+ System.out.println(SimpleBundle.MESSAGES.simpleTest());
+ }
+
+ @Test
+ public void testParameters() {
+ Assert.assertEquals("TST2 V1-bb", SimpleBundle.MESSAGES.parameters(1, "bb"));
+ }
+
+ @Test
+ public void testException() {
+ Exception ex = SimpleBundle.MESSAGES.someException();
+ Assert.assertEquals("TST3 EX", ex.getMessage());
+ }
+
+ @Test
+ public void testSomeExceptionParameter() {
+ String uuid = UUID.randomUUID().toString();
+ Assert.assertEquals(new Exception("TST4 EX-" + uuid).toString(), SimpleBundle.MESSAGES.someExceptionParameter(uuid).toString());
+ }
+
+ @Test
+ public void testPrint() {
+ SimpleBundle.MESSAGES.printMessage();
+ for (int i = 0; i < 10; i++) {
+ SimpleBundle.MESSAGES.printMessage(i);
+ }
+ }
+}
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ByteUtilTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ByteUtilTest.java
index b4eea724ed..efa686c174 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ByteUtilTest.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ByteUtilTest.java
@@ -27,7 +27,8 @@ import java.util.Map;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.internal.PlatformDependent;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
@@ -39,7 +40,7 @@ import static org.junit.Assert.fail;
public class ByteUtilTest {
- private static final Logger log = Logger.getLogger(ByteUtilTest.class);
+ private static final Logger log = LoggerFactory.getLogger(ByteUtilTest.class);
@Test
public void testBytesToString() {
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java
index e245d49b52..0ac4921009 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java
@@ -21,7 +21,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.junit.rules.ExternalResource;
/**
@@ -29,7 +30,7 @@ import org.junit.rules.ExternalResource;
*/
public class CleanupSystemPropertiesRule extends ExternalResource {
- private static Logger log = Logger.getLogger(CleanupSystemPropertiesRule.class);
+ private static Logger log = LoggerFactory.getLogger(CleanupSystemPropertiesRule.class);
private Properties originalProperties;
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodecTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodecTest.java
index c670345fa0..e9993c15f2 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodecTest.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodecTest.java
@@ -16,7 +16,8 @@
*/
package org.apache.activemq.artemis.utils;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.junit.Test;
import java.util.HashMap;
@@ -29,7 +30,7 @@ import static org.junit.Assert.fail;
public class DefaultSensitiveStringCodecTest {
- private static final Logger log = Logger.getLogger(DefaultSensitiveStringCodecTest.class);
+ private static final Logger log = LoggerFactory.getLogger(DefaultSensitiveStringCodecTest.class);
@Test
public void testDefaultAlgorithm() throws Exception {
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ExecuteUtil.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ExecuteUtil.java
index 921b5ab82d..fb18c1bf75 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ExecuteUtil.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ExecuteUtil.java
@@ -16,7 +16,8 @@
*/
package org.apache.activemq.artemis.utils;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.IOException;
@@ -72,7 +73,7 @@ public class ExecuteUtil {
return (int)pidField.get(process);
}
- private static final Logger logger = Logger.getLogger(ExecuteUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger(ExecuteUtil.class);
public static int runCommand(boolean logOutput, String... command) throws Exception {
return runCommand(logOutput, 10, TimeUnit.SECONDS, command);
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryRule.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryRule.java
index 7e40c62613..efb5ee042b 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryRule.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/RetryRule.java
@@ -17,7 +17,8 @@
package org.apache.activemq.artemis.utils;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.junit.internal.AssumptionViolatedException;
import org.junit.rules.MethodRule;
import org.junit.runners.model.FrameworkMethod;
@@ -31,7 +32,7 @@ public class RetryRule implements MethodRule {
public static final String PROPERTY_NAME = "org.apache.activemq.artemis.utils.RetryRule.retry";
- private static Logger logger = Logger.getLogger(RetryRule.class);
+ private static Logger logger = LoggerFactory.getLogger(RetryRule.class);
final int defaultNumberOfRetries;
final boolean retrySuccess;
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java
index bd7f80866f..b596bc81b8 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java
@@ -26,7 +26,8 @@ import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.junit.Assert;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
@@ -36,7 +37,7 @@ import org.junit.runner.Description;
*/
public class ThreadLeakCheckRule extends TestWatcher {
- private static Logger log = Logger.getLogger(ThreadLeakCheckRule.class);
+ private static Logger log = LoggerFactory.getLogger(ThreadLeakCheckRule.class);
private static Set<String> knownThreads = new HashSet<>();
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/actors/OrderedExecutorSanityTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/actors/OrderedExecutorSanityTest.java
index 86cdf81a31..8223efc979 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/actors/OrderedExecutorSanityTest.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/actors/OrderedExecutorSanityTest.java
@@ -26,12 +26,13 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.junit.Assert;
import org.junit.Test;
public class OrderedExecutorSanityTest {
- private static final Logger log = Logger.getLogger(OrderedExecutorSanityTest.class);
+ private static final Logger log = LoggerFactory.getLogger(OrderedExecutorSanityTest.class);
@Test
public void shouldExecuteTasksInOrder() throws InterruptedException {
diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/critical/MultiThreadCriticalMeasureTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/critical/MultiThreadCriticalMeasureTest.java
index 61fccf8160..591afd494f 100644
--- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/critical/MultiThreadCriticalMeasureTest.java
+++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/critical/MultiThreadCriticalMeasureTest.java
@@ -27,13 +27,14 @@ import java.util.concurrent.locks.LockSupport;
import org.apache.activemq.artemis.utils.ReusableLatch;
import org.apache.activemq.artemis.utils.Wait;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.junit.Assert;
import org.junit.Test;
public class MultiThreadCriticalMeasureTest {
- private static final Logger logger = Logger.getLogger(MultiThreadCriticalMeasureTest.class);
+ private static final Logger logger = LoggerFactory.getLogger(MultiThreadCriticalMeasureTest.class);
@Test
public void testMultiThread() throws Throwable {
diff --git a/pom.xml b/pom.xml
index 3a2c94753d..6087ba9578 100644
--- a/pom.xml
+++ b/pom.xml
@@ -688,7 +688,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
+ <version>${slf4j-version}</version>
<!-- License: MIT -->
</dependency>
<dependency>