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 13159ee1b9cac52025276688e2fc9fff793c2b7e Author: Robbie Gemmell <[email protected]> AuthorDate: Tue Sep 13 12:31:30 2022 +0100 try out simplifying to use auto-detected log4j2.properties config file --- TODO-new-logging.txt | 1 - .../main/java/org/apache/activemq/artemis/cli/commands/Create.java | 4 ++-- .../resources/org/apache/activemq/artemis/cli/commands/bin/artemis | 4 ---- .../apache/activemq/artemis/cli/commands/bin/artemis-service.xml | 2 -- .../org/apache/activemq/artemis/cli/commands/bin/artemis.cmd | 4 ---- .../commands/etc/{log4j2-config.properties => log4j2.properties} | 0 .../test/java/org/apache/activemq/cli/test/StreamClassPathTest.java | 2 +- docs/user-manual/en/logging.md | 6 +++--- docs/user-manual/en/using-server.md | 2 +- docs/user-manual/en/versions.md | 2 +- .../server0/{log4j2-config.properties => log4j2.properties} | 0 .../server0/{log4j2-config.properties => log4j2.properties} | 0 tests/e2e-tests/src/main/resources/containerService/artemis | 4 ---- .../serverA/{log4j2-config.properties => log4j2.properties} | 0 .../serverB/{log4j2-config.properties => log4j2.properties} | 0 .../serverA/{log4j2-config.properties => log4j2.properties} | 0 .../serverB/{log4j2-config.properties => log4j2.properties} | 0 .../serverRoot/{log4j2-config.properties => log4j2.properties} | 0 .../{log4j2-config.properties => log4j2.properties} | 0 .../audit-logging/{log4j2-config.properties => log4j2.properties} | 0 .../audit-logging2/{log4j2-config.properties => log4j2.properties} | 0 .../nettynative/{log4j2-config.properties => log4j2.properties} | 0 22 files changed, 8 insertions(+), 23 deletions(-) diff --git a/TODO-new-logging.txt b/TODO-new-logging.txt index d98ba62b9a..94ab19fac5 100644 --- a/TODO-new-logging.txt +++ b/TODO-new-logging.txt @@ -4,4 +4,3 @@ TODOs not explicitly noted in the code itself already: - Restore the Travis config file - Delete the old DELETE-ME-logging.properties and DELETE-ME-tests-logging.properties files once all needed comparisons during old test etc config replacements are done. - Decide what if anything should be done around the removed logging config reload bits (Log4J2 enables reload itself, via its own config...or updates via management) -- Decide if we should use the auto-detected log4j2.properties config filename instead of -Dlog4j2.configurationFile=log4j2-config.properties specified file. 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 582c3036b7..c0cc63b722 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 @@ -81,7 +81,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 = "log4j2-config.properties"; + public static final String ETC_LOG4J2_PROPERTIES = "log4j2.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"; @@ -822,7 +822,7 @@ public class Create extends InputAbstract { writeEtc(ETC_ARTEMIS_PROFILE, etcFolder, filters, true); } - writeEtc(ETC_LOGGING_PROPERTIES, etcFolder, null, false); + writeEtc(ETC_LOG4J2_PROPERTIES, etcFolder, null, false); if (noWeb) { filters.put("${bootstrap-web-settings}", ""); 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 42f093561e..5ee4f1e3a0 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 @@ -50,9 +50,6 @@ HAWTIO_ROLE="NO_HAWTIO_ROLE" ARTEMIS_INSTANCE_ETC='${artemis.instance.etc}' . "$ARTEMIS_INSTANCE_ETC/artemis.profile" -# Set Defaults Properties -ARTEMIS_LOGGING_CONF="$ARTEMIS_INSTANCE_ETC_URI/log4j2-config.properties" - CLASSPATH="$ARTEMIS_HOME/lib/artemis-boot.jar" @@ -115,7 +112,6 @@ exec "$JAVACMD" \ -Djava.io.tmpdir="$ARTEMIS_INSTANCE/tmp" \ -Ddata.dir="$ARTEMIS_DATA_DIR" \ -Dartemis.instance.etc="$ARTEMIS_INSTANCE_ETC" \ - -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-service.xml b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml index fe31529f1b..b6b08d3f06 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml @@ -50,7 +50,6 @@ <startargument>-Dartemis.instance=%ARTEMIS_INSTANCE%</startargument> <startargument>-Ddata.dir=%ARTEMIS_DATA_DIR%</startargument> <startargument>-Dartemis.instance.etc=%ARTEMIS_INSTANCE_ETC%</startargument> - <startargument>-Dlog4j2.configurationFile=%ARTEMIS_INSTANCE_ETC_URI%/log4j2-config.properties</startargument> <startargument>-Djava.security.auth.login.config=%ARTEMIS_INSTANCE_ETC%\login.config</startargument> <startargument>-Dhawtio.disableProxy=true</startargument> <startargument>-Dhawtio.realm=activemq</startargument> @@ -78,7 +77,6 @@ <stopargument>-Dartemis.instance=%ARTEMIS_INSTANCE%</stopargument> <stopargument>-Ddata.dir=%ARTEMIS_DATA_DIR%</stopargument> <stopargument>-Dartemis.instance.etc="%ARTEMIS_INSTANCE_ETC%"</stopargument> - <stopargument>-Dlog4j2.configurationFile=%ARTEMIS_INSTANCE_ETC_URI%/log4j2-config.properties</stopargument> <stopargument>org.apache.activemq.artemis.boot.Artemis</stopargument> 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 a403ffaa3a..ed7ea68955 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 @@ -48,9 +48,6 @@ rem "Load Profile Config" 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%/log4j2-config.properties - if not exist "%ARTEMIS_OOME_DUMP%" goto NO_ARTEMIS_OOME_DUMP rem "Backup the last OOME heap dump" move /Y "%ARTEMIS_OOME_DUMP%" "%ARTEMIS_OOME_DUMP%.bkp" @@ -65,7 +62,6 @@ 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% -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.properties similarity index 100% rename from artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/log4j2-config.properties rename to artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/log4j2.properties diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java index 4dd273b344..4bc1d1970c 100644 --- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java +++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java @@ -39,7 +39,7 @@ public class StreamClassPathTest { testStream(Create.class, Create.BIN_ARTEMIS); testStream(Create.class, Create.BIN_ARTEMIS_SERVICE); testStream(Create.class, "etc/" + Create.ETC_ARTEMIS_PROFILE); - testStream(Create.class, "etc/" + Create.ETC_LOGGING_PROPERTIES); + testStream(Create.class, "etc/" + Create.ETC_LOG4J2_PROPERTIES); testStream(Create.class, "etc/" + Create.ETC_BOOTSTRAP_XML); testStream(Create.class, "etc/" + Create.ETC_MANAGEMENT_XML); testStream(Create.class, "etc/" + Create.ETC_BROKER_XML); diff --git a/docs/user-manual/en/logging.md b/docs/user-manual/en/logging.md index 5b1acbc33c..7faf9a3912 100644 --- a/docs/user-manual/en/logging.md +++ b/docs/user-manual/en/logging.md @@ -2,7 +2,7 @@ Apache ActiveMQ Artemis uses the [SLF4J](https://www.slf4j.org/) logging facade for logging, with the broker assembly providing [Log4J 2](https://logging.apache.org/log4j/2.x/manual/) -as the logging implementation. This is configurable via the `log4j2-config.properties` file +as the logging implementation. This is configurable via the `log4j2.properties` file found in the broker instance `etc` directory, which is configured by default to log to both the console and to a file. @@ -61,7 +61,7 @@ called `log4j2.properties` which will be picked up automatically. Alternatively, use of a specific configuration file can be configured via system property `log4j2.configurationFile`, e.g.: ``` --Dlog4j2.configurationFile=file:///path/to/log4j2-config.properties +-Dlog4j2.configurationFile=file:///path/to/custom-log4j2-config.properties ``` The following is an example `log4j2.properties` for a client @@ -112,7 +112,7 @@ different types of broker events, these are: > the performance impact is "too much" will depend on your use-case. These three audit loggers are disabled by default in the broker -`log4j2-config.properties` configuration file: +`log4j2.properties` configuration file: ``` ... diff --git a/docs/user-manual/en/using-server.md b/docs/user-manual/en/using-server.md index 17e7707a22..08306054cc 100644 --- a/docs/user-manual/en/using-server.md +++ b/docs/user-manual/en/using-server.md @@ -441,7 +441,7 @@ further for additional details as appropriate. diverts, clustering; [full reference](configuration-index.md). - `jolokia-access.xml` - [security for Jolokia](https://jolokia.org/reference/html/security.html), specifically Cross-Origin Resource Sharing (CORS) - - `log4j2-config.properties` - [logging config](logging.md) like levels, log files + - `log4j2.properties` - [logging config](logging.md) like levels, log files locations, etc. - `login.config` - standard Java configuration for JAAS [security](security.md) - `management.xml` - remote connectivity and [security for JMX MBeans](management.md#role-based-authorisation-for-jmx) diff --git a/docs/user-manual/en/versions.md b/docs/user-manual/en/versions.md index b078a9737e..f327d24763 100644 --- a/docs/user-manual/en/versions.md +++ b/docs/user-manual/en/versions.md @@ -17,7 +17,7 @@ Highlights: #### Upgrading from older versions 1. <instance>/etc/logging.properties removal - 2. <instance>/etc/log4j2-config.properties creation + 2. <instance>/etc/log4j2.properties creation 3. Related script or profile changes ## 2.25.0 diff --git a/examples/features/standard/security-keycloak/src/main/resources/activemq/server0/log4j2-config.properties b/examples/features/standard/security-keycloak/src/main/resources/activemq/server0/log4j2.properties similarity index 100% rename from examples/features/standard/security-keycloak/src/main/resources/activemq/server0/log4j2-config.properties rename to examples/features/standard/security-keycloak/src/main/resources/activemq/server0/log4j2.properties diff --git a/examples/features/standard/security-ldap/src/main/resources/activemq/server0/log4j2-config.properties b/examples/features/standard/security-ldap/src/main/resources/activemq/server0/log4j2.properties similarity index 100% rename from examples/features/standard/security-ldap/src/main/resources/activemq/server0/log4j2-config.properties rename to examples/features/standard/security-ldap/src/main/resources/activemq/server0/log4j2.properties diff --git a/tests/e2e-tests/src/main/resources/containerService/artemis b/tests/e2e-tests/src/main/resources/containerService/artemis index ea6992bf24..4ab71c12f6 100755 --- a/tests/e2e-tests/src/main/resources/containerService/artemis +++ b/tests/e2e-tests/src/main/resources/containerService/artemis @@ -50,9 +50,6 @@ HAWTIO_ROLE="NO_HAWTIO_ROLE" ARTEMIS_INSTANCE_ETC='/var/lib/artemis-instance/etc' . "$ARTEMIS_INSTANCE_ETC/artemis.profile" -# Set Defaults Properties -ARTEMIS_LOGGING_CONF="$ARTEMIS_INSTANCE_ETC_URI/log4j2-config.properties" - CLASSPATH="$ARTEMIS_HOME/lib/artemis-boot.jar" @@ -115,7 +112,6 @@ exec "$JAVACMD" \ -Djava.io.tmpdir="$ARTEMIS_INSTANCE/tmp" \ -Ddata.dir="$ARTEMIS_DATA_DIR" \ -Dartemis.instance.etc="$ARTEMIS_INSTANCE_ETC" \ - -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/tests/e2e-tests/src/main/resources/servers/brokerConnect/serverA/log4j2-config.properties b/tests/e2e-tests/src/main/resources/servers/brokerConnect/serverA/log4j2.properties similarity index 100% rename from tests/e2e-tests/src/main/resources/servers/brokerConnect/serverA/log4j2-config.properties rename to tests/e2e-tests/src/main/resources/servers/brokerConnect/serverA/log4j2.properties diff --git a/tests/e2e-tests/src/main/resources/servers/brokerConnect/serverB/log4j2-config.properties b/tests/e2e-tests/src/main/resources/servers/brokerConnect/serverB/log4j2.properties similarity index 100% rename from tests/e2e-tests/src/main/resources/servers/brokerConnect/serverB/log4j2-config.properties rename to tests/e2e-tests/src/main/resources/servers/brokerConnect/serverB/log4j2.properties diff --git a/tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverA/log4j2-config.properties b/tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverA/log4j2.properties similarity index 100% rename from tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverA/log4j2-config.properties rename to tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverA/log4j2.properties diff --git a/tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverB/log4j2-config.properties b/tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverB/log4j2.properties similarity index 100% rename from tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverB/log4j2-config.properties rename to tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverB/log4j2.properties diff --git a/tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverRoot/log4j2-config.properties b/tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverRoot/log4j2.properties similarity index 100% rename from tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverRoot/log4j2-config.properties rename to tests/e2e-tests/src/main/resources/servers/brokerConnect/splitMirror/serverRoot/log4j2.properties diff --git a/tests/smoke-tests/src/main/resources/servers/audit-logging-amqp-mutual-ssl/log4j2-config.properties b/tests/smoke-tests/src/main/resources/servers/audit-logging-amqp-mutual-ssl/log4j2.properties similarity index 100% rename from tests/smoke-tests/src/main/resources/servers/audit-logging-amqp-mutual-ssl/log4j2-config.properties rename to tests/smoke-tests/src/main/resources/servers/audit-logging-amqp-mutual-ssl/log4j2.properties diff --git a/tests/smoke-tests/src/main/resources/servers/audit-logging/log4j2-config.properties b/tests/smoke-tests/src/main/resources/servers/audit-logging/log4j2.properties similarity index 100% rename from tests/smoke-tests/src/main/resources/servers/audit-logging/log4j2-config.properties rename to tests/smoke-tests/src/main/resources/servers/audit-logging/log4j2.properties diff --git a/tests/smoke-tests/src/main/resources/servers/audit-logging2/log4j2-config.properties b/tests/smoke-tests/src/main/resources/servers/audit-logging2/log4j2.properties similarity index 100% rename from tests/smoke-tests/src/main/resources/servers/audit-logging2/log4j2-config.properties rename to tests/smoke-tests/src/main/resources/servers/audit-logging2/log4j2.properties diff --git a/tests/smoke-tests/src/main/resources/servers/nettynative/log4j2-config.properties b/tests/smoke-tests/src/main/resources/servers/nettynative/log4j2.properties similarity index 100% rename from tests/smoke-tests/src/main/resources/servers/nettynative/log4j2-config.properties rename to tests/smoke-tests/src/main/resources/servers/nettynative/log4j2.properties
