You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ro...@apache.org on 2022/09/26 16:46:51 UTC

[activemq-artemis] branch new-logging updated (aeb9e4b0e4 -> cadebbca25)

This is an automated email from the ASF dual-hosted git repository.

robbie pushed a change to branch new-logging
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


    from aeb9e4b0e4 change some scopes to test only, supply logging impl via assembly distribution pom only
     new 082f07ec30 remove some TODOs we wont do, add some javadoc explaining deprecations
     new cadebbca25 remove some unused bits from the annotation processor

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../artemis/logs/annotation/LogMessage.java        | 25 ++++++++---
 .../processor/LogAnnotationProcessor.java          | 52 +++-------------------
 2 files changed, 24 insertions(+), 53 deletions(-)


[activemq-artemis] 01/02: remove some TODOs we wont do, add some javadoc explaining deprecations

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch new-logging
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 082f07ec307ce8ad13a0acda1e83195504be2a04
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Mon Sep 26 17:36:25 2022 +0100

    remove some TODOs we wont do, add some javadoc explaining deprecations
---
 .../artemis/logs/annotation/LogMessage.java        | 25 ++++++++++++++++------
 .../processor/LogAnnotationProcessor.java          |  8 +++----
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/LogMessage.java b/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/LogMessage.java
index 985d0fb299..cf0cd1859a 100644
--- a/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/LogMessage.java
+++ b/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/LogMessage.java
@@ -32,12 +32,25 @@ public @interface LogMessage {
    Level level();
 
    enum Level {
-      ERROR, WARN, INFO,
-      // TODO DEBUG and TRACE will be removed.
-        @Deprecated DEBUG, @Deprecated TRACE;
-
-      Level() {
-      }
+      ERROR,
+      WARN,
+      INFO,
+
+      /**
+       * @deprecated Typically debug/trace logging will use class-level loggers
+       *             rather than generated loggers with codes. This mostly exists
+       *             for existing historic uses and any unexpected level down-grades.
+       */
+      @Deprecated
+      DEBUG,
+
+      /**
+       * @deprecated Typically debug/trace logging will use class-level loggers
+       *             rather than generated loggers with codes. This mostly exists
+       *             for existing historic uses and any unexpected level down-grades.
+       */
+      @Deprecated
+      TRACE;
    }
 
 
diff --git a/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/processor/LogAnnotationProcessor.java b/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/processor/LogAnnotationProcessor.java
index 5ac6766ca3..d615a70e1b 100644
--- a/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/processor/LogAnnotationProcessor.java
+++ b/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/processor/LogAnnotationProcessor.java
@@ -465,9 +465,9 @@ public class LogAnnotationProcessor extends AbstractProcessor {
             return "info";
          case ERROR:
             return "error";
-         case DEBUG: // TODO remove this
+         case DEBUG:
             return "debug";
-         case TRACE: // TODO remove this
+         case TRACE:
             return  "trace";
          default:
             throw new IllegalStateException("Illegal log level: " + messageAnnotation.level());
@@ -482,9 +482,9 @@ public class LogAnnotationProcessor extends AbstractProcessor {
             return "isInfoEnabled";
          case ERROR:
             return "isErrorEnabled";
-         case DEBUG: // TODO remove this
+         case DEBUG:
             return "isDebugEnabled";
-         case TRACE: // TODO remove this
+         case TRACE:
             return "isTraceEnabled";
          default:
             throw new IllegalStateException("Illegal log level: " + messageAnnotation.level());


[activemq-artemis] 02/02: remove some unused bits from the annotation processor

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch new-logging
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit cadebbca25c55b21bd65abfcea6982d8b17914c3
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Mon Sep 26 17:41:27 2022 +0100

    remove some unused bits from the annotation processor
---
 .../processor/LogAnnotationProcessor.java          | 44 +---------------------
 1 file changed, 1 insertion(+), 43 deletions(-)

diff --git a/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/processor/LogAnnotationProcessor.java b/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/processor/LogAnnotationProcessor.java
index d615a70e1b..12e26cadbe 100644
--- a/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/processor/LogAnnotationProcessor.java
+++ b/artemis-log-annotation-processor/src/main/java/org/apache/activemq/artemis/logs/annotation/processor/LogAnnotationProcessor.java
@@ -31,10 +31,8 @@ import javax.lang.model.type.TypeMirror;
 import javax.tools.Diagnostic;
 import javax.tools.JavaFileObject;
 import java.io.PrintWriter;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Objects;
 import java.util.Set;
@@ -72,38 +70,10 @@ public class LogAnnotationProcessor extends AbstractProcessor {
       }
    }
 
-
-   private static class DocLogging implements Comparable<DocLogging> {
-      DocLogging(String code, String message) {
-         this.code = code;
-         this.message = message;
-      }
-      String code;
-      String message;
-
-      @Override
-      public int compareTo(DocLogging o) {
-         return code.compareTo(o.code);
-      }
-   }
-
-   private static class DocLoggingComparator implements Comparator<DocLogging> {
-
-      @Override
-      public int compare(DocLogging o1, DocLogging o2) {
-         o1.compareTo(o2);
-         return 0;
-      }
-   }
-
    @Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
       HashMap<Integer, String> messages = new HashMap<>();
 
-      List<DocLogging> docExceptions = new LinkedList<>();
-      List<DocLogging> docMessages = new LinkedList<>();
-
-
       try {
          for (TypeElement annotation : annotations) {
             for (Element annotatedTypeEl : roundEnv.getElementsAnnotatedWith(annotation)) {
@@ -180,7 +150,6 @@ public class LogAnnotationProcessor extends AbstractProcessor {
                            debug("... annotated with " + messageAnnotation);
                         }
                         generateMessage(bundleAnnotation, writerOutput, executableMember, messageAnnotation, messages);
-                        docExceptions.add(new DocLogging(bundleAnnotation.projectCode() + messageAnnotation.id(), messageAnnotation.value()));
                      }
 
                      if (logAnnotation != null) {
@@ -190,7 +159,6 @@ public class LogAnnotationProcessor extends AbstractProcessor {
                            debug("... annotated with " + logAnnotation);
                         }
                         generateLogger(bundleAnnotation, writerOutput, executableMember, logAnnotation, messages);
-                        docMessages.add(new DocLogging(bundleAnnotation.projectCode() + logAnnotation.id(), logAnnotation.value()));
                      }
 
                      if (getLogger != null) {
@@ -210,6 +178,7 @@ public class LogAnnotationProcessor extends AbstractProcessor {
 
                writerOutput.println("}");
                writerOutput.close();
+
                if (DEBUG) {
                   debug("done processing " + fullClassName);
                   debug("*******************************************************************************************************************************");
@@ -223,17 +192,6 @@ public class LogAnnotationProcessor extends AbstractProcessor {
          return false;
       }
 
-      /* this is a placeholder for a prototype on generating docs...
-      Collections.sort(docExceptions);
-      Collections.sort(docMessages);
-
-      docMessages.forEach((o) -> {
-         System.out.println("This is a doc for " + o.code + " = " + o.message);
-      });
-      docExceptions.forEach((o) -> {
-         System.out.println("This is a exception for " + o.code + " = " + o.message);
-      }); */
-
       return true;
    }