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/20 16:07:56 UTC

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

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 03cb081e1cf6b60a72fd7b5a193a5859f45b8946
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