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/12 16:22:27 UTC

[activemq-artemis] branch new-logging updated: Tweaks on log processor to support Exception, add DEBUG and TRACE (temporarily)

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


The following commit(s) were added to refs/heads/new-logging by this push:
     new 97e3f781f9 Tweaks on log processor to support Exception, add DEBUG and TRACE (temporarily)
97e3f781f9 is described below

commit 97e3f781f923a6ae08e05dcd74e0a0556f183bbc
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Thu May 12 12:22:09 2022 -0400

    Tweaks on log processor to support Exception, add DEBUG and TRACE (temporarily)
---
 .../artemis/logprocessor/LogProcessor.java         | 13 +++++++--
 .../core/server/ActiveMQServerNewLogger.java       | 34 ----------------------
 2 files changed, 10 insertions(+), 37 deletions(-)

diff --git a/artemis-log-processor/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java b/artemis-log-processor/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java
index 986ea09cc4..f63536c37b 100644
--- a/artemis-log-processor/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java
+++ b/artemis-log-processor/src/main/java/org/apache/activemq/artemis/logprocessor/LogProcessor.java
@@ -215,11 +215,14 @@ public class LogProcessor extends AbstractProcessor {
       if (executableMember.getReturnType().toString().equals(String.class.getName())) {
          writerOutput.println("      return returnString;");
       } else {
+         writerOutput.println("      {");
+         writerOutput.println("         " + executableMember.getReturnType().toString() + " exceptionReturn = new " + executableMember.getReturnType().toString() + "(returnString);");
+
          if (exceptionParameter != null) {
-            writerOutput.println("      return new " + executableMember.getReturnType().toString() + "(returnString, " + exceptionParameter.getSimpleName() + ");");
-         } else {
-            writerOutput.println("      return new " + executableMember.getReturnType().toString() + "(returnString);");
+            writerOutput.println("         exceptionReturn.initCause(" + exceptionParameter.getSimpleName() + ");");
          }
+         writerOutput.println("         return exceptionReturn;");
+         writerOutput.println("      }");
       }
 
       writerOutput.println("   }");
@@ -306,6 +309,10 @@ public class LogProcessor extends AbstractProcessor {
             methodName="info"; break;
          case ERROR:
             methodName="error"; break;
+         case DEBUG: // TODO remove this
+            methodName="debug"; break;
+         case TRACE: // TODO remove this
+            methodName="trace"; break;
          default:
             throw new IllegalStateException("illegal method level " + messageAnnotation.level());
       }
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerNewLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerNewLogger.java
deleted file mode 100644
index 881493cde0..0000000000
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerNewLogger.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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
- *
- *     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 org.apache.activemq.artemis.core.server;
-
-import org.apache.activemq.artemis.artlog.CodeFactory;
-import org.apache.activemq.artemis.artlog.annotation.ArtemisBundle;
-import org.apache.activemq.artemis.artlog.annotation.LogMessage;
-
-@ArtemisBundle(projectCode = "AMQ")
-public interface ActiveMQServerNewLogger {
-
-   /**
-    * The default logger.
-    */
-   ActiveMQServerNewLogger LOGGER = CodeFactory.getMessageLogger(ActiveMQServerNewLogger.class);
-
-   @LogMessage(id = 223000, value = "This is great, {0}")
-   void simpleTest(String componentClassName);
-}
-