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/07/13 17:38:16 UTC

[activemq-artemis] branch new-logging updated (f454dbb5df -> c2e27fc6a1)

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 f454dbb5df add some more needed deps; essentially every module with tests (or without specific log test config) will need this to avoid a stacktrace from logging setup issues
     new 92408fc7b4 make a start on a basic loging config for distribution
     new c2e27fc6a1 fix format of code prefix in messages, pointed out by failing test

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:
 .../apache/activemq/artemis/cli/commands/Create.java    |  2 +-
 .../apache/activemq/artemis/cli/commands/bin/artemis    |  6 ++----
 .../activemq/artemis/cli/commands/bin/artemis.cmd       |  6 ++----
 .../artemis/cli/commands/etc/log4j2-config.properties   | 17 ++++++-----------
 .../java/org/apache/activemq/cli/test/ArtemisTest.java  |  2 +-
 .../activemq/artemis/logprocessor/LogProcessor.java     |  4 ++--
 6 files changed, 14 insertions(+), 23 deletions(-)
 copy tests/config/log4j2-tests-config-CI.properties => artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/log4j2-config.properties (73%)


[activemq-artemis] 02/02: fix format of code prefix in messages, pointed out by failing test

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 c2e27fc6a1d43d43523bf0f58162a1ed2d4cab9a
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Wed Jul 13 18:37:38 2022 +0100

    fix format of code prefix in messages, pointed out by failing test
---
 .../src/test/java/org/apache/activemq/cli/test/ArtemisTest.java       | 2 +-
 .../java/org/apache/activemq/artemis/logprocessor/LogProcessor.java   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
index ca8c354178..73cbd0ffc5 100644
--- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
+++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java
@@ -506,7 +506,7 @@ public class ArtemisTest extends CliTestBase {
          context = new TestActionContext();
          addCmd.execute(context);
          result = context.getStderr();
-         assertTrue(result.contains("Failed to add user scott. Reason: AMQ229223: User scott already exists"));
+         assertTrue("Unexpected output: '" + result + "'", result.contains("Failed to add user scott. Reason: AMQ229223: User scott already exists"));
 
          //check existing users are intact
          context = new TestActionContext();
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 a3f80f3c29..d88d690eaa 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
@@ -240,7 +240,7 @@ public class LogProcessor extends AbstractProcessor {
       writerOutput.println(")");
       writerOutput.println("   {");
 
-      String formattingString = encodeSpecialChars(bundleAnnotation.projectCode() + messageAnnotation.id() + " " + messageAnnotation.value());
+      String formattingString = encodeSpecialChars(bundleAnnotation.projectCode() + messageAnnotation.id() + ": " + messageAnnotation.value());
       if (!hasParameters) {
          writerOutput.println("     String returnString = \"" + formattingString + "\";");
       } else {
@@ -390,7 +390,7 @@ public class LogProcessor extends AbstractProcessor {
       }
 
       //TODO: handle causes being passed in the args to be logged, but not necessarily (often not) being last arg at present as SLF4J/frameworks expect.
-      String formattingString = encodeSpecialChars(bundleAnnotation.projectCode() + messageAnnotation.id() + " " + messageAnnotation.value());
+      String formattingString = encodeSpecialChars(bundleAnnotation.projectCode() + messageAnnotation.id() + ": " + messageAnnotation.value());
       if (!hasParameters) {
          writerOutput.println("      logger." + methodName + "(\"" + formattingString + "\");");
       } else {


[activemq-artemis] 01/02: make a start on a basic loging config for distribution

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 92408fc7b46b64027e1662eccc3224b2e9a0d223
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Wed Jul 13 18:36:41 2022 +0100

    make a start on a basic loging config for distribution
---
 .../activemq/artemis/cli/commands/Create.java      |  2 +-
 .../activemq/artemis/cli/commands/bin/artemis      |  6 ++--
 .../activemq/artemis/cli/commands/bin/artemis.cmd  |  6 ++--
 .../cli/commands/etc/log4j2-config.properties      | 37 ++++++++++++++++++++++
 4 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
index ea9e741289..a1ff0d2ece 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
@@ -82,7 +82,7 @@ public class Create extends InputAbstract {
    public static final String BIN_ARTEMIS = "bin/artemis";
    public static final String BIN_ARTEMIS_SERVICE = "bin/artemis-service";
    public static final String ETC_ARTEMIS_PROFILE = "artemis.profile";
-   public static final String ETC_LOGGING_PROPERTIES = "logging.properties";
+   public static final String ETC_LOGGING_PROPERTIES = "log4j2-config.properties";
    public static final String ETC_BOOTSTRAP_XML = "bootstrap.xml";
    public static final String ETC_MANAGEMENT_XML = "management.xml";
    public static final String ETC_BROKER_XML = "broker.xml";
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis
index 4f8e2f3b66..5d8a2a3477 100755
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis
@@ -51,8 +51,7 @@ ARTEMIS_INSTANCE_ETC='${artemis.instance.etc}'
 . "$ARTEMIS_INSTANCE_ETC/artemis.profile"
 
 # Set Defaults Properties
-ARTEMIS_LOGGING_CONF="$ARTEMIS_INSTANCE_ETC_URI/logging.properties"
-ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager
+ARTEMIS_LOGGING_CONF="$ARTEMIS_INSTANCE_ETC_URI/log4j2-config.properties"
 
 
 CLASSPATH="$ARTEMIS_HOME/lib/artemis-boot.jar"
@@ -132,8 +131,7 @@ exec "$JAVACMD" \
     -Djava.io.tmpdir="$ARTEMIS_INSTANCE/tmp" \
     -Ddata.dir="$ARTEMIS_DATA_DIR" \
     -Dartemis.instance.etc="$ARTEMIS_INSTANCE_ETC" \
-    -Djava.util.logging.manager="$ARTEMIS_LOG_MANAGER" \
-    -Dlogging.configuration="$ARTEMIS_LOGGING_CONF" \
+    -Dlog4j2.configurationFile="$ARTEMIS_LOGGING_CONF" \
     -Dartemis.default.sensitive.string.codec.key="$ARTEMIS_DEFAULT_SENSITIVE_STRING_CODEC_KEY" \
     $DEBUG_ARGS \
     org.apache.activemq.artemis.boot.Artemis "$@"
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
index 2d39231708..a403ffaa3a 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
@@ -49,8 +49,7 @@ set ARTEMIS_INSTANCE_ETC="${artemis.instance.etc}"
 call %ARTEMIS_INSTANCE_ETC%\artemis.profile.cmd %*
 
 rem "Set Defaults."
-set ARTEMIS_LOGGING_CONF=%ARTEMIS_INSTANCE_ETC_URI%/logging.properties
-set ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager
+set ARTEMIS_LOGGING_CONF=%ARTEMIS_INSTANCE_ETC_URI%/log4j2-config.properties
 
 if not exist "%ARTEMIS_OOME_DUMP%" goto NO_ARTEMIS_OOME_DUMP
 rem "Backup the last OOME heap dump"
@@ -66,8 +65,7 @@ set JVM_ARGS=%JVM_ARGS% -Dartemis.home=%ARTEMIS_HOME%
 set JVM_ARGS=%JVM_ARGS% -Dartemis.instance=%ARTEMIS_INSTANCE%
 set JVM_ARGS=%JVM_ARGS% -Ddata.dir=%ARTEMIS_DATA_DIR%
 set JVM_ARGS=%JVM_ARGS% -Dartemis.instance.etc=%ARTEMIS_INSTANCE_ETC%
-set JVM_ARGS=%JVM_ARGS% -Djava.util.logging.manager=%ARTEMIS_LOG_MANAGER%
-set JVM_ARGS=%JVM_ARGS% -Dlogging.configuration=%ARTEMIS_LOGGING_CONF%
+set JVM_ARGS=%JVM_ARGS% -Dlog4j2.configurationFile=%ARTEMIS_LOGGING_CONF%
 set JVM_ARGS=%JVM_ARGS% -Dartemis.default.sensitive.string.codec.key=%ARTEMIS_DEFAULT_SENSITIVE_STRING_CODEC_KEY%
 
 if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS%
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/log4j2-config.properties b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/log4j2-config.properties
new file mode 100644
index 0000000000..32ba2f9680
--- /dev/null
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/log4j2-config.properties
@@ -0,0 +1,37 @@
+# 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.
+
+# Log4J 2 configuration
+rootLogger = INFO, Console
+
+logger.activemq.name=org.apache.activemq
+logger.activemq.level=INFO
+
+# Audit logger:
+logger.audit.name=org.apache.activemq.audit
+logger.audit.level=INFO
+#TODO: copy specific audit loggers config
+
+# quorum logger levels
+logger.curator.name=org.apache.curator
+logger.curator.level=WARN
+logger.zookeeper.name=org.apache.zookeeper
+logger.zookeeper.level=ERROR
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=[%t] %d{HH:mm:ss,SSS} %-5level [%logger] %msg%n