diff --git a/activemq-all/pom.xml b/activemq-all/pom.xml
index 01630fa0496..1e623dfe118 100644
--- a/activemq-all/pom.xml
+++ b/activemq-all/pom.xml
@@ -60,12 +60,8 @@
geronimo-annotation_1.0_spec
- org.slf4j
- slf4j-log4j12
-
-
- org.slf4j
- jcl-over-slf4j
+ org.apache.logging.log4j
+ log4j-slf4j-impl
@@ -109,9 +105,8 @@
org.apache.geronimo.specs:geronimo-j2ee-management_1.1_specorg.apache.geronimo.specs:geronimo-annotation_1.0_specorg.slf4j:slf4j-api
- org.slf4j:slf4j-log4j12
+ org.apache.logging:log4j-slf4j-implorg.slf4j:jcl-over-slf4j
- log4j:log4jorg.springframework:spring-coreorg.springframework:spring-beansorg.springframework:spring-context
@@ -347,15 +342,15 @@
true
- org.slf4j
- slf4j-log4j12
- ${slf4j-version}
+ org.apache.logging
+ log4j-slf4j-impl
+ ${log4j-version}sourcestrue
- log4j
- log4j
+ org.apache.logging
+ log4j-api${log4j-version}sourcestrue
diff --git a/activemq-all/src/main/resources/log4j.properties b/activemq-all/src/main/resources/log4j2.properties
similarity index 58%
rename from activemq-all/src/main/resources/log4j.properties
rename to activemq-all/src/main/resources/log4j2.properties
index 0cb38c4c4d0..08ed0630c05 100644
--- a/activemq-all/src/main/resources/log4j.properties
+++ b/activemq-all/src/main/resources/log4j2.properties
@@ -19,25 +19,42 @@
# This file controls most of the logging in ActiveMQ which is mainly based around
# the commons logging API.
#
-log4j.rootLogger=INFO, console
-log4j.logger.org.apache.activemq.spring=WARN
-log4j.logger.org.apache.activemq.web.handler=WARN
-log4j.logger.org.springframework=WARN
-log4j.logger.org.apache.xbean=WARN
-log4j.logger.org.apache.camel=INFO
-log4j.logger.org.eclipse.jetty=WARN
+rootLogger.level=INFO
+rootLogger.appenderRef.console.ref=Console
+rootLogger.appenderRef.console.filter.threshold.type=ThresholdFilter
+rootLogger.appenderRef.console.filter.threshold.level=INFO
+
+logger.spring.name=org.apache.activemq.spring
+logger.spring.level=WARN
+
+logger.handler.name=org.apache.activemq.web.handler
+logger.handler.level=WARN
+
+logger.springframework.name=org.springframework
+logger.springframework.level=WARN
+
+logger.xbean.name=org.apache.xbean
+logger.xbean.level=WARN
+
+logger.camel.name=org.apache.camel
+logger.camel.level=INFO
+
+logger.jetty.name=org.eclipse.jetty
+logger.jetty.level=WARN
# When debugging or reporting problems to the ActiveMQ team,
# comment out the above lines and uncomment the next.
-#log4j.rootLogger=DEBUG, logfile, console
+#rootLogger.level=DEBUG
# Or for more fine grained debug logging uncomment one of these
-#log4j.logger.org.apache.activemq=DEBUG
-#log4j.logger.org.apache.camel=DEBUG
+#logger.activemq.name=org.apache.activemq
+#logger.activemq.level=DEBUG
+#logger.camel.name=org.apache.camel
+#logger.camel.level=DEBUG
# Console appender
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%5p | %m%n
-log4j.appender.console.threshold=INFO
\ No newline at end of file
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=%5p | %m%n
\ No newline at end of file
diff --git a/activemq-amqp/pom.xml b/activemq-amqp/pom.xml
index e6fa92f247c..c764f11c736 100644
--- a/activemq-amqp/pom.xml
+++ b/activemq-amqp/pom.xml
@@ -130,8 +130,8 @@
test
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
diff --git a/activemq-amqp/src/test/resources/log4j.properties b/activemq-amqp/src/test/resources/log4j.properties
deleted file mode 100644
index 64d4fb03782..00000000000
--- a/activemq-amqp/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,45 +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.
-#
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=INFO
-log4j.logger.org.apache.activemq.transport.amqp=DEBUG
-log4j.logger.org.apache.activemq.transport.amqp.client.FRAMES=TRACE
-log4j.logger.org.apache.activemq.transport.amqp.FRAMES=TRACE
-log4j.logger.org.fusesource=INFO
-
-# Configure various level of detail for Qpid JMS logs.
-log4j.logger.org.apache.qpid.jms=INFO
-log4j.logger.org.apache.qpid.jms.provider=INFO
-log4j.logger.org.apache.qpid.jms.provider.amqp=INFO
-log4j.logger.org.apache.qpid.jms.provider.amqp.FRAMES=INFO
-
-# Console will only display warnings
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d [%-15.15t] - %-5p %-25.30c{1} - %m%n
-log4j.appender.console.threshold=TRACE
-
-# File appender will contain all info messages
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
-log4j.appender.file.file=target/test.log
-log4j.appender.file.append=true
diff --git a/activemq-amqp/src/test/resources/log4j2-test.properties b/activemq-amqp/src/test/resources/log4j2-test.properties
new file mode 100644
index 00000000000..9194a4ebc68
--- /dev/null
+++ b/activemq-amqp/src/test/resources/log4j2-test.properties
@@ -0,0 +1,74 @@
+#
+# 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.
+#
+
+#
+# The logging properties used during tests
+#
+rootLogger.level=WARN
+
+rootLogger.appenderRef.console.ref=Console
+rootLogger.appenderRef.console.filter.threshold.type=ThresholdFilter
+rootLogger.appenderRef.console.filter.threshold.level=TRACE
+rootLogger.appenderRef.logfile.ref=RollingFile
+
+logger.activemq.name=org.apache.activemq
+logger.activemq.level=INFO
+
+logger.amqp.name=org.apache.activemq.transport.amqp
+logger.amqp.level=DEBUG
+
+logger.clientframes.name=org.apache.activemq.transport.amqp.client.FRAMES
+logger.clientframes.level=TRACE
+
+logger.frames.name=org.apache.activemq.transport.amqp.FRAMES
+logger.frames.level=TRACE
+
+logger.fusesource.name=org.fusesource
+logger.fusesource.level=INFO
+
+# Configure various level of detail for Qpid JMS logs.
+logger.qpid.name=org.apache.qpid.jms
+logger.qpid.level=INFO
+
+logger.qpidprovider.name=org.apache.qpid.jms.provider
+logger.qpidprovider.level=INFO
+
+logger.qpidamqp.name=org.apache.qpid.jms.provider.amqp
+logger.qpidamqp.level=INFO
+
+logger.qpidframes.name=org.apache.qpid.jms.provider.amqp.FRAMES
+logger.qpidframes.level=INFO
+
+# Appender configuration
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=%d [%-15.15t] - %-5p %-25.30c{1} - %m%n
+
+# RollingFile appender
+appender.logfile.type=RollingRandomAccessFile
+appender.logfile.name=RollingFile
+appender.logfile.fileName=target/test.log
+appender.logfile.filePattern=target/test.log.%i
+appender.logfile.append=true
+appender.logfile.layout.type=PatternLayout
+appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+appender.logfile.policies.type=Policies
+appender.logfile.policies.size.type=SizeBasedTriggeringPolicy
+appender.logfile.policies.size.size=1MB
\ No newline at end of file
diff --git a/activemq-broker/pom.xml b/activemq-broker/pom.xml
index 50386a74039..ea8ecac5f80 100644
--- a/activemq-broker/pom.xml
+++ b/activemq-broker/pom.xml
@@ -83,8 +83,13 @@
test
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-core
+ test
+
+
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
@@ -105,7 +110,6 @@
${javase-javadoc-url}
${javaee-javadoc-url}
- ${slf4j-javadoc-url}
http://junit.sourceforge.net/javadoc/
${basedir}/../etc/css/stylesheet.css
diff --git a/activemq-broker/src/test/java/org/apache/activemq/util/DefaultTestAppender.java b/activemq-broker/src/test/java/org/apache/activemq/util/DefaultTestAppender.java
index 97ca4b3f5d7..b68c6b6bb4f 100644
--- a/activemq-broker/src/test/java/org/apache/activemq/util/DefaultTestAppender.java
+++ b/activemq-broker/src/test/java/org/apache/activemq/util/DefaultTestAppender.java
@@ -17,67 +17,72 @@
package org.apache.activemq.util;
-import org.apache.log4j.Appender;
-import org.apache.log4j.Layout;
-import org.apache.log4j.spi.ErrorHandler;
-import org.apache.log4j.spi.Filter;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.ErrorHandler;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LogEvent;
public abstract class DefaultTestAppender implements Appender {
String name = this.getClass().getSimpleName();
-
- @Override
- public void addFilter(Filter newFilter) {
+ @Override
+ public String getName() {
+ return name;
}
@Override
- public Filter getFilter() {
+ public ErrorHandler getHandler() {
return null;
}
@Override
- public void clearFilters() {
+ public void setHandler(ErrorHandler handler) {
}
@Override
- public void close() {
-
+ public Layout getLayout() {
+ return null;
}
@Override
- public String getName() {
- return name;
+ public void append(LogEvent event) {
+
}
@Override
- public void setErrorHandler(ErrorHandler errorHandler) {
-
+ public boolean ignoreExceptions() {
+ return true;
}
@Override
- public ErrorHandler getErrorHandler() {
+ public State getState() {
return null;
}
@Override
- public void setLayout(Layout layout) {
+ public void initialize() {
}
@Override
- public Layout getLayout() {
- return null;
+ public void start() {
+
}
@Override
- public void setName(String name) {
- this.name = name;
+ public void stop() {
+
+ }
+
+ @Override
+ public boolean isStarted() {
+ return false;
}
@Override
- public boolean requiresLayout() {
+ public boolean isStopped() {
return false;
}
}
diff --git a/activemq-broker/src/test/resources/log4j.properties b/activemq-broker/src/test/resources/log4j.properties
deleted file mode 100644
index 7cc19418fdc..00000000000
--- a/activemq-broker/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,42 +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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, out, stdout
-
-#log4j.logger.org.apache.activemq.broker.scheduler=DEBUG
-#log4j.logger.org.apache.activemq.network.DemandForwardingBridgeSupport=DEBUG
-#log4j.logger.org.apache.activemq.transport.failover=TRACE
-#log4j.logger.org.apache.activemq.store.jdbc=TRACE
-#log4j.logger.org.apache.activemq.broker.region.cursors.AbstractStoreCursor=DEBUG
-#log4j.logger.org.apache.activemq.store.jdbc.JDBCMessageStore=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
-#log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
-log4j.appender.out.file=target/activemq-test.log
-log4j.appender.out.append=true
diff --git a/activemq-broker/src/test/resources/log4j2-test.properties b/activemq-broker/src/test/resources/log4j2-test.properties
new file mode 100644
index 00000000000..220bf0ca49e
--- /dev/null
+++ b/activemq-broker/src/test/resources/log4j2-test.properties
@@ -0,0 +1,57 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests
+#
+rootLogger.level=INFO
+
+rootLogger.appenderRef.console.ref=Console
+rootLogger.appenderRef.logfile.ref=RollingFile
+
+#logger.scheduler.name=org.apache.activemq.broker.scheduler
+#logger.scheduler.level=DEBUG
+#logger.network.name=org.apache.activemq.network.DemandForwardingBridgeSupport
+#logger.network.level=DEBUG
+#logger.failover.name=org.apache.activemq.transport.failover
+#logger.failover.level=TRACE
+#logger.jdbc.name=org.apache.activemq.store.jdbc
+#logger.jdbc.level=TRACE
+#logger.cursors.name=org.apache.activemq.broker.region.cursors.AbstractStoreCursor
+#logger.cursors.level=DEBUG
+
+# Appender configuration
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+#appender.console.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
+
+# RollingFile appender
+appender.logfile.type=RollingRandomAccessFile
+appender.logfile.name=RollingFile
+appender.logfile.fileName=target/activemq-test.log
+appender.logfile.filePattern=target/activemq-test.log.%i
+appender.logfile.append=true
+appender.logfile.layout.type=PatternLayout
+appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+#appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
+appender.logfile.policies.type=Policies
+appender.logfile.policies.size.type=SizeBasedTriggeringPolicy
+appender.logfile.policies.size.size=1MB
diff --git a/activemq-client/pom.xml b/activemq-client/pom.xml
index ae9f394215a..aab0911b9cf 100644
--- a/activemq-client/pom.xml
+++ b/activemq-client/pom.xml
@@ -80,8 +80,8 @@
test
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
diff --git a/activemq-client/src/test/resources/log4j.properties b/activemq-client/src/test/resources/log4j.properties
deleted file mode 100644
index 7cc19418fdc..00000000000
--- a/activemq-client/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,42 +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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, out, stdout
-
-#log4j.logger.org.apache.activemq.broker.scheduler=DEBUG
-#log4j.logger.org.apache.activemq.network.DemandForwardingBridgeSupport=DEBUG
-#log4j.logger.org.apache.activemq.transport.failover=TRACE
-#log4j.logger.org.apache.activemq.store.jdbc=TRACE
-#log4j.logger.org.apache.activemq.broker.region.cursors.AbstractStoreCursor=DEBUG
-#log4j.logger.org.apache.activemq.store.jdbc.JDBCMessageStore=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
-#log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
-log4j.appender.out.file=target/activemq-test.log
-log4j.appender.out.append=true
diff --git a/activemq-client/src/test/resources/log4j2-test.properties b/activemq-client/src/test/resources/log4j2-test.properties
new file mode 100644
index 00000000000..16e26c52266
--- /dev/null
+++ b/activemq-client/src/test/resources/log4j2-test.properties
@@ -0,0 +1,55 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests
+#
+rootLogger.level=INFO
+
+rootLogger.appenderRef.console.ref=Console
+rootLogger.appenderRef.logfile.ref=RollingFile
+
+#logger.scheduler.name=org.apache.activemq.broker.scheduler
+#logger.scheduler.level=DEBUG
+#logger.network.name=org.apache.activemq.network.DemandForwardingBridgeSupport
+#logger.network.level=DEBUG
+#logger.failover.name=org.apache.activemq.transport.failover
+#logger.failover.level=TRACE
+#logger.jdbc.name=org.apache.activemq.store.jdbc
+#logger.jdbc.level=TRACE
+#logger.cursors.name=org.apache.activemq.broker.region.cursors.AbstractStoreCursor
+#logger.cursors.level=DEBUG
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+#appender.console.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
+
+# RollingFile appender
+appender.logfile.type=RollingRandomAccessFile
+appender.logfile.name=RollingFile
+appender.logfile.fileName=target/activemq-test.log
+appender.logfile.filePattern=target/activemq-test.log.%i
+appender.logfile.append=true
+appender.logfile.layout.type=PatternLayout
+appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+#appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
+appender.logfile.policies.type=Policies
+appender.logfile.policies.size.type=SizeBasedTriggeringPolicy
+appender.logfile.policies.size.size=1MB
diff --git a/activemq-console/pom.xml b/activemq-console/pom.xml
index 55726f8934f..b4bf1c269d8 100644
--- a/activemq-console/pom.xml
+++ b/activemq-console/pom.xml
@@ -104,13 +104,13 @@
test
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
- log4j
- log4j
+ org.apache.logging.log4j
+ log4j-coretest
@@ -165,10 +165,10 @@
org.apache.activemq.default.directory.prefixtarget/
-
-
diff --git a/activemq-console/src/main/java/org/apache/activemq/console/Main.java b/activemq-console/src/main/java/org/apache/activemq/console/Main.java
index 4e2db4f1e24..a6d507accaf 100644
--- a/activemq-console/src/main/java/org/apache/activemq/console/Main.java
+++ b/activemq-console/src/main/java/org/apache/activemq/console/Main.java
@@ -67,7 +67,7 @@ public static void main(String[] args) {
// Parse for extension directory option
app.parseExtensions(tokens);
- // lets add the conf directory first, to find the log4j.properties just in case its not
+ // lets add the conf directory first, to find the log4j2-test.properties just in case its not
// in the activemq.classpath system property or some jar incorrectly includes one
File confDir = app.getActiveMQConfig();
app.addClassPath(confDir);
diff --git a/activemq-console/src/test/resources/log4j.properties b/activemq-console/src/test/resources/log4j.properties
deleted file mode 100644
index a0f2ca0f202..00000000000
--- a/activemq-console/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,66 +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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=DEBUG, stdout, out
-log4j.logger.org.apache.activemq.spring=WARN
-
-log4j.logger.org.apache.activemq=INFO
-log4j.logger.org.apache.activemq.console.command.AMQJournalToolTest=DEBUG
-
-# CONSOLE appender, not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
-log4j.appender.out.file=target/activemq-test.log
-log4j.appender.out.append=true
-
-
-# Example of properties to make use of new logging options
-#
-#log4j.rootLogger=INFO, A
-#log4j.additivity.org.apache.activemq.transport.TransportLogger=false
-#log4j.logger.org.apache.activemq.transport.TransportLogger=DEBUG, B
-#
-# CONSOLE appender, not used by default
-#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-#log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-#
-# File appender for normal output
-#log4j.appender.A=org.apache.log4j.FileAppender
-#log4j.appender.A.File=applog
-#log4j.appender.A.BufferedIO=false
-#log4j.appender.A.layout=org.apache.log4j.PatternLayout
-#log4j.appender.A.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-#
-# File appender for transport level logging output
-#log4j.appender.B=org.apache.log4j.FileAppender
-#log4j.appender.B.File=transportlog
-#log4j.appender.B.BufferedIO=false
-#log4j.appender.B.layout=org.apache.log4j.PatternLayout
-#log4j.appender.B.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-#
-# End of example
\ No newline at end of file
diff --git a/activemq-console/src/test/resources/log4j2-test.properties b/activemq-console/src/test/resources/log4j2-test.properties
new file mode 100644
index 00000000000..b2214cc026e
--- /dev/null
+++ b/activemq-console/src/test/resources/log4j2-test.properties
@@ -0,0 +1,52 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests
+#
+rootLogger.level=DEBUG
+
+rootLogger.appenderRef.console.ref=Console
+rootLogger.appenderRef.logfile.ref=RollingFile
+
+logger.spring.name=org.apache.activemq.spring
+logger.spring.level=WARN
+
+logger.activemq.name=org.apache.activemq
+logger.activemq.level=INFO
+
+logger.console.name=org.apache.activemq.console.command.AMQJournalToolTest
+logger.console.level=DEBUG
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# RollingFile appender
+appender.logfile.type=RollingRandomAccessFile
+appender.logfile.name=RollingFile
+appender.logfile.fileName=target/activemq-test.log
+appender.logfile.filePattern=target/activemq-test.log.%i
+appender.logfile.append=true
+appender.logfile.layout.type=PatternLayout
+appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+appender.logfile.policies.type=Policies
+appender.logfile.policies.size.type=SizeBasedTriggeringPolicy
+appender.logfile.policies.size.size=1MB
+
diff --git a/activemq-http/pom.xml b/activemq-http/pom.xml
index 36f5467671d..8b66104744e 100644
--- a/activemq-http/pom.xml
+++ b/activemq-http/pom.xml
@@ -108,8 +108,8 @@
true
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
diff --git a/activemq-http/src/test/resources/log4j.properties b/activemq-http/src/test/resources/log4j.properties
deleted file mode 100644
index 2aabf97d35b..00000000000
--- a/activemq-http/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,47 +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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, out, stdout
-
-log4j.logger.org.apache.activemq.transport.ws=TRACE
-log4j.logger.org.apache.activemq.transport.http=DEBUG
-log4j.logger.org.apache.activemq.transport.amqp=TRACE
-log4j.logger.org.apache.activemq.transport.amqp.FRAMES=TRACE
-
-#log4j.logger.org.apache.activemq.broker.scheduler=DEBUG
-#log4j.logger.org.apache.activemq.network.DemandForwardingBridgeSupport=DEBUG
-#log4j.logger.org.apache.activemq.transport.failover=TRACE
-#log4j.logger.org.apache.activemq.store.jdbc=TRACE
-#log4j.logger.org.apache.activemq.broker.region.cursors.AbstractStoreCursor=DEBUG
-#log4j.logger.org.apache.activemq.store.jdbc.JDBCMessageStore=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
-#log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
-log4j.appender.out.file=target/activemq-test.log
-log4j.appender.out.append=true
diff --git a/activemq-http/src/test/resources/log4j2-test.properties b/activemq-http/src/test/resources/log4j2-test.properties
new file mode 100644
index 00000000000..8eed9af13e3
--- /dev/null
+++ b/activemq-http/src/test/resources/log4j2-test.properties
@@ -0,0 +1,67 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests
+#
+rootLogger.level=INFO
+
+rootLogger.appenderRef.console.ref=Console
+rootLogger.appenderRef.logfile.ref=RollingFile
+
+logger.transportws.name=org.apache.activemq.transport.ws
+logger.transportws.level=TRACE
+
+logger.transporthttp.name=org.apache.activemq.transport.http
+logger.transporthttp.level=DEBUG
+
+logger.transportamqp.name=org.apache.activemq.transport.amqp
+logger.transportamqp.level=TRACE
+
+logger.frames.name=org.apache.activemq.transport.amqp.FRAMES
+logger.frames.level=TRACE
+
+#logger.scheduler.name=org.apache.activemq.broker.scheduler
+#logger.scheduler.level=DEBUG
+#logger.network.name=org.apache.activemq.network.DemandForwardingBridgeSupport
+#logger.network.level=DEBUG
+#logger.failover.name=org.apache.activemq.transport.failover
+#logger.failover.level=TRACE
+#logger.jdbc.name=org.apache.activemq.store.jdbc
+#logger.jdbc.level=TRACE
+#logger.cursors.name=org.apache.activemq.broker.region.cursors.AbstractStoreCursor
+#logger.cursors.level=DEBUG
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+#appender.console.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
+
+# RollingFile appender
+appender.logfile.type=RollingRandomAccessFile
+appender.logfile.name=RollingFile
+appender.logfile.fileName=target/activemq-test.log
+appender.logfile.filePattern=target/activemq-test.log.%i
+appender.logfile.append=true
+appender.logfile.layout.type=PatternLayout
+appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+#appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
+appender.logfile.policies.type=Policies
+appender.logfile.policies.size.type=SizeBasedTriggeringPolicy
+appender.logfile.policies.size.size=1MB
diff --git a/activemq-itests-spring31/pom.xml b/activemq-itests-spring31/pom.xml
index bca914b14e5..ca814b36105 100644
--- a/activemq-itests-spring31/pom.xml
+++ b/activemq-itests-spring31/pom.xml
@@ -73,13 +73,13 @@
test
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
- log4j
- log4j
+ org.apache.logging.log4j
+ log4j-coretest
diff --git a/activemq-jaas/pom.xml b/activemq-jaas/pom.xml
index 80b243676e4..8137437e95f 100644
--- a/activemq-jaas/pom.xml
+++ b/activemq-jaas/pom.xml
@@ -87,6 +87,12 @@
apacheds-server-integ${directory-version}test
+
+
+ log4j
+ log4j
+
+ junit
@@ -100,8 +106,8 @@
test
- log4j
- log4j
+ org.apache.logging.log4j
+ log4j-coretest
@@ -109,8 +115,8 @@
slf4j-api
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
diff --git a/activemq-jaas/src/test/resources/log4j.properties b/activemq-jaas/src/test/resources/log4j.properties
deleted file mode 100644
index 5d00c973a28..00000000000
--- a/activemq-jaas/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,36 +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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, out, stdout
-
-log4j.logger.org.apache.activemq=INFO
-#log4j.logger.org.apache.activemq.jaas.LDAPLoginModule=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.out.file=target/activemq-test.log
-log4j.appender.out.append=true
diff --git a/activemq-jaas/src/test/resources/log4j2-test.properties b/activemq-jaas/src/test/resources/log4j2-test.properties
new file mode 100644
index 00000000000..edecc0e4817
--- /dev/null
+++ b/activemq-jaas/src/test/resources/log4j2-test.properties
@@ -0,0 +1,48 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests
+#
+rootLogger.level=INFO
+
+rootLogger.appenderRef.console.ref=Console
+rootLogger.appenderRef.logfile.ref=RollingFile
+
+logger.activemq.name=org.apache.activemq
+logger.activemq.level=INFO
+
+#logger.jaas.name=org.apache.activemq.jaas.LDAPLoginModule
+#logger.jaas.level=DEBUG
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# RollingFile appender
+appender.logfile.type=RollingRandomAccessFile
+appender.logfile.name=RollingFile
+appender.logfile.fileName=target/activemq-test.log
+appender.logfile.filePattern=target/activemq-test.log.%i
+appender.logfile.append=true
+appender.logfile.layout.type=PatternLayout
+appender.logfile.layout.pattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.logfile.policies.type=Policies
+appender.logfile.policies.size.type=SizeBasedTriggeringPolicy
+appender.logfile.policies.size.size=1MB
diff --git a/activemq-jdbc-store/pom.xml b/activemq-jdbc-store/pom.xml
index 285a4751a96..30c4dc35d37 100644
--- a/activemq-jdbc-store/pom.xml
+++ b/activemq-jdbc-store/pom.xml
@@ -79,8 +79,8 @@
test
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
@@ -114,7 +114,7 @@
org.apache.activemq.default.directory.prefixtarget/
-
diff --git a/activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapterDoCreateTablesTest.java b/activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/CommitsTheTransactionTest.java
similarity index 52%
rename from activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapterDoCreateTablesTest.java
rename to activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/CommitsTheTransactionTest.java
index 08f31f7fa76..4cf85486596 100644
--- a/activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/DefaultJDBCAdapterDoCreateTablesTest.java
+++ b/activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/CommitsTheTransactionTest.java
@@ -16,8 +16,6 @@
*/
package org.apache.activemq.store.jdbc.adapter;
-import static org.apache.log4j.Level.DEBUG;
-import static org.apache.log4j.Level.WARN;
import static org.junit.Assert.assertEquals;
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.inOrder;
@@ -33,12 +31,13 @@
import org.apache.activemq.store.jdbc.Statements;
import org.apache.activemq.store.jdbc.TransactionContext;
-import org.apache.activemq.util.DefaultTestAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.spi.LoggingEvent;
-import org.junit.After;
-import org.junit.Before;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.Property;
+import org.apache.logging.log4j.core.filter.AbstractFilter;
+import org.apache.logging.log4j.core.layout.MessageLayout;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
@@ -46,7 +45,7 @@
import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
-public class DefaultJDBCAdapterDoCreateTablesTest {
+public class CommitsTheTransactionTest {
private static final String CREATE_STATEMENT1 = "createStatement1";
private static final String CREATE_STATEMENT2 = "createStatement2";
@@ -57,7 +56,7 @@ public class DefaultJDBCAdapterDoCreateTablesTest {
private DefaultJDBCAdapter defaultJDBCAdapter;
- private List loggingEvents = new ArrayList<>();
+ private List loggingEvents = new ArrayList<>();
@Mock
private TransactionContext transactionContext;
@@ -74,18 +73,19 @@ public class DefaultJDBCAdapterDoCreateTablesTest {
@Mock
private Statement statement1, statement2;
- @Before
- public void setUp() throws IOException, SQLException {
- DefaultTestAppender appender = new DefaultTestAppender() {
+ @Test
+ public void commitsTheTransactionWhenAutoCommitIsDisabled() throws SQLException, IOException {
+ final var logger = org.apache.logging.log4j.core.Logger.class.cast(LogManager.getRootLogger());
+ final var appender = new AbstractAppender("testAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) {
@Override
- public void doAppend(LoggingEvent event) {
- loggingEvents.add(event);
+ public void append(LogEvent event) {
+ loggingEvents.add(event.toImmutable());
}
};
- Logger rootLogger = Logger.getRootLogger();
- rootLogger.setLevel(Level.DEBUG);
- rootLogger.addAppender(appender);
+ appender.start();
+ logger.get().addAppender(appender, Level.DEBUG, new AbstractFilter() {});
+ logger.addAppender(appender);
defaultJDBCAdapter = new DefaultJDBCAdapter();
defaultJDBCAdapter.statements = statements;
@@ -95,62 +95,7 @@ public void doAppend(LoggingEvent event) {
when(connection.getMetaData().getTables(null, null, this.statements.getFullMessageTableName(),new String[] { "TABLE" })).thenReturn(resultSet);
when(connection.createStatement()).thenReturn(statement1, statement2);
when(connection.getAutoCommit()).thenReturn(true);
- }
-
- @After
- public void tearDown() {
- loggingEvents = new ArrayList<>();
- }
-
- @Test
- public void createsTheTablesWhenNoMessageTableExistsAndLogsSqlExceptionsInWarnLevel() throws IOException, SQLException {
- when(resultSet.next()).thenReturn(false);
- when(statement2.execute(CREATE_STATEMENT2)).thenThrow(new SQLException(MY_REASON, SQL_STATE, VENDOR_CODE));
-
- defaultJDBCAdapter.doCreateTables(transactionContext);
- InOrder inOrder = inOrder(resultSet, connection, statement1, statement2);
- inOrder.verify(resultSet).next();
- inOrder.verify(resultSet).close();
- inOrder.verify(connection).createStatement();
- inOrder.verify(statement1).execute(CREATE_STATEMENT1);
- inOrder.verify(statement1).close();
- inOrder.verify(connection).createStatement();
- inOrder.verify(statement2).execute(CREATE_STATEMENT2);
- inOrder.verify(statement2).close();
-
- assertEquals(4, loggingEvents.size());
- assertLog(0, DEBUG, "Executing SQL: " + CREATE_STATEMENT1);
- assertLog(1, DEBUG, "Executing SQL: " + CREATE_STATEMENT2);
- assertLog(2, WARN, "Could not create JDBC tables; they could already exist. Failure was: " + CREATE_STATEMENT2 + " Message: " + MY_REASON + " SQLState: " + SQL_STATE + " Vendor code: " + VENDOR_CODE);
- assertLog(3, WARN, "Failure details: " + MY_REASON);
- }
-
- @Test
- public void triesTocreateTheTablesWhenMessageTableExistsAndLogsSqlExceptionsInDebugLevel() throws SQLException, IOException {
- when(resultSet.next()).thenReturn(true);
- when(statement1.execute(CREATE_STATEMENT1)).thenThrow(new SQLException(MY_REASON, SQL_STATE, VENDOR_CODE));
-
- defaultJDBCAdapter.doCreateTables(transactionContext);
-
- InOrder inOrder = inOrder(resultSet, connection, statement1, statement2);
- inOrder.verify(resultSet).next();
- inOrder.verify(resultSet).close();
- inOrder.verify(connection).createStatement();
- inOrder.verify(statement1).execute(CREATE_STATEMENT1);
- inOrder.verify(statement1).close();
- inOrder.verify(connection).createStatement();
- inOrder.verify(statement2).execute(CREATE_STATEMENT2);
- inOrder.verify(statement2).close();
-
- assertEquals(3, loggingEvents.size());
- assertLog(0, DEBUG, "Executing SQL: " + CREATE_STATEMENT1);
- assertLog(1, DEBUG, "Could not create JDBC tables; The message table already existed. Failure was: " + CREATE_STATEMENT1 + " Message: " + MY_REASON + " SQLState: " + SQL_STATE + " Vendor code: " + VENDOR_CODE);
- assertLog(2, DEBUG, "Executing SQL: " + CREATE_STATEMENT2);
- }
-
- @Test
- public void commitsTheTransactionWhenAutoCommitIsDisabled() throws SQLException, IOException {
when(connection.getAutoCommit()).thenReturn(false);
when(resultSet.next()).thenReturn(false);
@@ -169,13 +114,15 @@ public void commitsTheTransactionWhenAutoCommitIsDisabled() throws SQLException,
inOrder.verify(statement2).close();
assertEquals(2, loggingEvents.size());
- assertLog(0, DEBUG, "Executing SQL: " + CREATE_STATEMENT1);
- assertLog(1, DEBUG, "Executing SQL: " + CREATE_STATEMENT2);
+ assertLog(0, Level.DEBUG, "Executing SQL: " + CREATE_STATEMENT1);
+ assertLog(1, Level.DEBUG, "Executing SQL: " + CREATE_STATEMENT2);
+
+ loggingEvents = new ArrayList<>();
}
private void assertLog(int messageNumber, Level level, String message) {
- LoggingEvent loggingEvent = loggingEvents.get(messageNumber);
+ LogEvent loggingEvent = loggingEvents.get(messageNumber);
assertEquals(level, loggingEvent.getLevel());
- assertEquals(message, loggingEvent.getMessage());
+ assertEquals(message, loggingEvent.getMessage().getFormattedMessage());
}
}
\ No newline at end of file
diff --git a/activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/JDBCTablesExistsTest.java b/activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/JDBCTablesExistsTest.java
new file mode 100644
index 00000000000..27fedc5497d
--- /dev/null
+++ b/activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/JDBCTablesExistsTest.java
@@ -0,0 +1,127 @@
+/**
+ * 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.store.jdbc.adapter;
+
+import org.apache.activemq.store.jdbc.Statements;
+import org.apache.activemq.store.jdbc.TransactionContext;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.Property;
+import org.apache.logging.log4j.core.filter.AbstractFilter;
+import org.apache.logging.log4j.core.layout.MessageLayout;
+import org.junit.runner.RunWith;
+import org.mockito.InOrder;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Answers.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class JDBCTablesExistsTest {
+
+ private static final String CREATE_STATEMENT1 = "createStatement1";
+ private static final String CREATE_STATEMENT2 = "createStatement2";
+ private static final String[] CREATE_STATEMENTS = new String[]{CREATE_STATEMENT1, CREATE_STATEMENT2};
+ private static final int VENDOR_CODE = 1;
+ private static final String SQL_STATE = "SqlState";
+ private static final String MY_REASON = "MyReason";
+
+ private DefaultJDBCAdapter defaultJDBCAdapter;
+
+ private List loggingEvents = new ArrayList<>();
+
+ @Mock
+ private TransactionContext transactionContext;
+
+ @Mock(answer = RETURNS_DEEP_STUBS)
+ private Connection connection;
+
+ @Mock
+ private Statements statements;
+
+ @Mock
+ private ResultSet resultSet;
+
+ @Mock
+ private Statement statement1, statement2;
+
+ @org.junit.Test
+ public void createsTheTablesWhenNoMessageTableExistsAndLogsSqlExceptionsInWarnLevel() throws IOException, SQLException {
+ final var logger = org.apache.logging.log4j.core.Logger.class.cast(LogManager.getRootLogger());
+ final var appender = new AbstractAppender("testAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) {
+ @Override
+ public void append(LogEvent event) {
+ loggingEvents.add(event.toImmutable());
+ }
+ };
+ appender.start();
+
+ logger.get().addAppender(appender, Level.DEBUG, new AbstractFilter() {});
+ logger.addAppender(appender);
+
+ defaultJDBCAdapter = new DefaultJDBCAdapter();
+ defaultJDBCAdapter.statements = statements;
+
+ when(statements.getCreateSchemaStatements()).thenReturn(CREATE_STATEMENTS);
+ when(transactionContext.getConnection()).thenReturn(connection);
+ when(connection.getMetaData().getTables(null, null, this.statements.getFullMessageTableName(),new String[] { "TABLE" })).thenReturn(resultSet);
+ when(connection.createStatement()).thenReturn(statement1, statement2);
+ when(connection.getAutoCommit()).thenReturn(true);
+
+ when(resultSet.next()).thenReturn(false);
+ when(statement2.execute(CREATE_STATEMENT2)).thenThrow(new SQLException(MY_REASON, SQL_STATE, VENDOR_CODE));
+
+ defaultJDBCAdapter.doCreateTables(transactionContext);
+
+ InOrder inOrder = inOrder(resultSet, connection, statement1, statement2);
+ inOrder.verify(resultSet).next();
+ inOrder.verify(resultSet).close();
+ inOrder.verify(connection).createStatement();
+ inOrder.verify(statement1).execute(CREATE_STATEMENT1);
+ inOrder.verify(statement1).close();
+ inOrder.verify(connection).createStatement();
+ inOrder.verify(statement2).execute(CREATE_STATEMENT2);
+ inOrder.verify(statement2).close();
+
+ assertEquals(4, loggingEvents.size());
+ assertLog(0, Level.DEBUG, "Executing SQL: " + CREATE_STATEMENT1);
+ assertLog(1, Level.DEBUG, "Executing SQL: " + CREATE_STATEMENT2);
+ assertLog(2, Level.WARN, "Could not create JDBC tables; they could already exist. Failure was: " + CREATE_STATEMENT2 + " Message: " + MY_REASON + " SQLState: " + SQL_STATE + " Vendor code: " + VENDOR_CODE);
+ assertLog(3, Level.WARN, "Failure details: " + MY_REASON);
+
+ }
+
+ private void assertLog(int messageNumber, Level level, String message) {
+ LogEvent loggingEvent = loggingEvents.get(messageNumber);
+ assertEquals(level, loggingEvent.getLevel());
+ assertEquals(message, loggingEvent.getMessage().getFormattedMessage());
+ }
+
+}
\ No newline at end of file
diff --git a/activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/TriesToCreateTablesTest.java b/activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/TriesToCreateTablesTest.java
new file mode 100644
index 00000000000..f3015c949a2
--- /dev/null
+++ b/activemq-jdbc-store/src/test/java/org/apache/activemq/store/jdbc/adapter/TriesToCreateTablesTest.java
@@ -0,0 +1,128 @@
+/**
+ * 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.store.jdbc.adapter;
+
+import org.apache.activemq.store.jdbc.Statements;
+import org.apache.activemq.store.jdbc.TransactionContext;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.Property;
+import org.apache.logging.log4j.core.filter.AbstractFilter;
+import org.apache.logging.log4j.core.layout.MessageLayout;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InOrder;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Answers.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class TriesToCreateTablesTest {
+
+ private static final String CREATE_STATEMENT1 = "createStatement1";
+ private static final String CREATE_STATEMENT2 = "createStatement2";
+ private static final String[] CREATE_STATEMENTS = new String[] { CREATE_STATEMENT1, CREATE_STATEMENT2 };
+ private static final int VENDOR_CODE = 1;
+ private static final String SQL_STATE = "SqlState";
+ private static final String MY_REASON = "MyReason";
+
+ private DefaultJDBCAdapter defaultJDBCAdapter;
+
+ private List loggingEvents = new ArrayList<>();
+
+ @Mock
+ private TransactionContext transactionContext;
+
+ @Mock(answer = RETURNS_DEEP_STUBS)
+ private Connection connection;
+
+ @Mock
+ private Statements statements;
+
+ @Mock
+ private ResultSet resultSet;
+
+ @Mock
+ private Statement statement1, statement2;
+
+ @Test
+ public void triesToCreateTheTablesWhenMessageTableExistsAndLogsSqlExceptionsInDebugLevel() throws SQLException, IOException {
+ final var logger = org.apache.logging.log4j.core.Logger.class.cast(LogManager.getRootLogger());
+ final var appender = new AbstractAppender("testAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) {
+ @Override
+ public void append(LogEvent event) {
+ loggingEvents.add(event.toImmutable());
+ }
+ };
+ appender.start();
+
+ logger.get().addAppender(appender, Level.DEBUG, new AbstractFilter() {});
+ logger.addAppender(appender);
+
+ defaultJDBCAdapter = new DefaultJDBCAdapter();
+ defaultJDBCAdapter.statements = statements;
+
+ when(statements.getCreateSchemaStatements()).thenReturn(CREATE_STATEMENTS);
+ when(transactionContext.getConnection()).thenReturn(connection);
+ when(connection.getMetaData().getTables(null, null, this.statements.getFullMessageTableName(),new String[] { "TABLE" })).thenReturn(resultSet);
+ when(connection.createStatement()).thenReturn(statement1, statement2);
+ when(connection.getAutoCommit()).thenReturn(true);
+
+ when(resultSet.next()).thenReturn(true);
+ when(statement1.execute(CREATE_STATEMENT1)).thenThrow(new SQLException(MY_REASON, SQL_STATE, VENDOR_CODE));
+
+ defaultJDBCAdapter.doCreateTables(transactionContext);
+
+ InOrder inOrder = inOrder(resultSet, connection, statement1, statement2);
+ inOrder.verify(resultSet).next();
+ inOrder.verify(resultSet).close();
+ inOrder.verify(connection).createStatement();
+ inOrder.verify(statement1).execute(CREATE_STATEMENT1);
+ inOrder.verify(statement1).close();
+ inOrder.verify(connection).createStatement();
+ inOrder.verify(statement2).execute(CREATE_STATEMENT2);
+ inOrder.verify(statement2).close();
+
+ assertEquals(3, loggingEvents.size());
+ assertLog(0, Level.DEBUG, "Executing SQL: " + CREATE_STATEMENT1);
+ assertLog(1, Level.DEBUG, "Could not create JDBC tables; The message table already existed. Failure was: " + CREATE_STATEMENT1 + " Message: " + MY_REASON + " SQLState: " + SQL_STATE + " Vendor code: " + VENDOR_CODE);
+ assertLog(2, Level.DEBUG, "Executing SQL: " + CREATE_STATEMENT2);
+
+ loggingEvents = new ArrayList<>();
+ }
+
+ private void assertLog(int messageNumber, Level level, String message) {
+ LogEvent loggingEvent = loggingEvents.get(messageNumber);
+ assertEquals(level, loggingEvent.getLevel());
+ assertEquals(message, loggingEvent.getMessage().getFormattedMessage());
+ }
+
+}
diff --git a/activemq-jdbc-store/src/test/resources/log4j2-test.properties b/activemq-jdbc-store/src/test/resources/log4j2-test.properties
new file mode 100644
index 00000000000..df04ea9f1c4
--- /dev/null
+++ b/activemq-jdbc-store/src/test/resources/log4j2-test.properties
@@ -0,0 +1,58 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests
+#
+rootLogger.level=DEBUG
+rootLogger.appenderRef.console.ref=Console
+rootLogger.appenderRef.console.filter.threshold.type=ThresholdFilter
+rootLogger.appenderRef.console.filter.threshold.level=INFO
+rootLogger.appenderRef.logfile.ref=RollingFile
+
+#logger.scheduler.name=org.apache.activemq.broker.scheduler
+#logger.scheduler.level=DEBUG
+#logger.network.name=org.apache.activemq.network.DemandForwardingBridgeSupport
+#logger.network.level=DEBUG
+#logger.failover.name=org.apache.activemq.transport.failover
+#logger.failover.level=TRACE
+#logger.jdbc.name=org.apache.activemq.store.jdbc
+#logger.jdbc.level=TRACE
+#logger.cursors.name=org.apache.activemq.broker.region.cursors.AbstractStoreCursor
+#logger.cursors.level=DEBUG
+
+# Appender configuration
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+#appender.console.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
+
+# RollingFile appender
+appender.logfile.type=RollingRandomAccessFile
+appender.logfile.name=RollingFile
+appender.logfile.fileName=target/activemq-test.log
+appender.logfile.filePattern=target/activemq-test.log.%i
+appender.logfile.append=true
+appender.logfile.layout.type=PatternLayout
+appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+#appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
+appender.logfile.policies.type=Policies
+appender.logfile.policies.size.type=SizeBasedTriggeringPolicy
+appender.logfile.policies.size.size=1MB
diff --git a/activemq-jms-pool/pom.xml b/activemq-jms-pool/pom.xml
index 1283cb5f4a4..f89c2726377 100644
--- a/activemq-jms-pool/pom.xml
+++ b/activemq-jms-pool/pom.xml
@@ -89,13 +89,13 @@
test
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
- log4j
- log4j
+ org.apache.logging.log4j
+ log4j-coretest
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java
index 071bb6ba8bb..3c7095ece4c 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryMaximumActiveTest.java
@@ -30,7 +30,8 @@
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.junit.Test;
/**
@@ -40,7 +41,7 @@
*/
public class PooledConnectionFactoryMaximumActiveTest extends JmsPoolTestSupport {
- public final static Logger LOG = Logger.getLogger(PooledConnectionFactoryMaximumActiveTest.class);
+ public final static Logger LOG = LogManager.getLogger(PooledConnectionFactoryMaximumActiveTest.class);
public static Connection conn = null;
public static int sleepTimeout = 5000;
@@ -94,7 +95,7 @@ public void testApp() throws Exception {
static class TestRunner2 implements Callable {
- public final static Logger TASK_LOG = Logger.getLogger(TestRunner2.class);
+ public final static Logger TASK_LOG = LogManager.getLogger(TestRunner2.class);
/**
* @return true if test succeeded, false otherwise
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
index 9e486f4a3bd..803e72a445f 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionFactoryTest.java
@@ -36,7 +36,8 @@
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.command.ConnectionId;
import org.apache.activemq.util.Wait;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -52,7 +53,7 @@
*/
public class PooledConnectionFactoryTest extends JmsPoolTestSupport {
- public final static Logger LOG = Logger.getLogger(PooledConnectionFactoryTest.class);
+ public final static Logger LOG = LogManager.getLogger(PooledConnectionFactoryTest.class);
@Test(timeout = 60000)
public void testInstanceOf() throws Exception {
@@ -345,7 +346,7 @@ public boolean isSatisified() throws Exception {
static class TestRunner implements Callable {
- public final static Logger LOG = Logger.getLogger(TestRunner.class);
+ public final static Logger LOG = LogManager.getLogger(TestRunner.class);
/**
* @return true if test succeeded, false otherwise
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionBlockTimeoutTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionBlockTimeoutTest.java
index fe0a7ee16ff..c5ab15647e0 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionBlockTimeoutTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionBlockTimeoutTest.java
@@ -38,7 +38,8 @@
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.TransportConnector;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.junit.After;
import org.junit.Test;
@@ -46,7 +47,7 @@ public class PooledSessionExhaustionBlockTimeoutTest extends JmsPoolTestSupport
private static final String QUEUE = "FOO";
private static final int NUM_MESSAGES = 500;
- private final Logger LOG = Logger.getLogger(getClass());
+ private final Logger LOG = LogManager.getLogger(PooledSessionExhaustionBlockTimeoutTest.class);
private ActiveMQConnectionFactory factory;
private PooledConnectionFactory pooledFactory;
diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionTest.java
index b92cd396c99..bbfb4caba42 100644
--- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionTest.java
+++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledSessionExhaustionTest.java
@@ -36,7 +36,8 @@
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.TransportConnector;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -46,7 +47,7 @@ public class PooledSessionExhaustionTest extends JmsPoolTestSupport {
private static final String QUEUE = "FOO";
private static final int NUM_MESSAGES = 500;
- private static final Logger LOG = Logger.getLogger(PooledSessionExhaustionTest.class);
+ private static final Logger LOG = LogManager.getLogger(PooledSessionExhaustionTest.class);
private ActiveMQConnectionFactory factory;
private PooledConnectionFactory pooledFactory;
diff --git a/activemq-jms-pool/src/test/resources/log4j.properties b/activemq-jms-pool/src/test/resources/log4j.properties
deleted file mode 100644
index 2543c16e29b..00000000000
--- a/activemq-jms-pool/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,38 +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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, out, stdout
-
-log4j.logger.org.apache.activemq.spring=WARN
-#log4j.logger.org.apache.activemq.usecases=DEBUG
-#log4j.logger.org.apache.activemq.broker.region=DEBUG
-log4j.logger.org.apache.activemq.jms.pool=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.out.file=target/activemq-test.log
-log4j.appender.out.append=true
diff --git a/activemq-jms-pool/src/test/resources/log4j2-test.properties b/activemq-jms-pool/src/test/resources/log4j2-test.properties
new file mode 100644
index 00000000000..af4efea81ad
--- /dev/null
+++ b/activemq-jms-pool/src/test/resources/log4j2-test.properties
@@ -0,0 +1,54 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests
+#
+rootLogger.level=INFO
+
+rootLogger.appenderRef.console.ref=Console
+rootLogger.appenderRef.logfile.ref=RollingFile
+
+logger.spring.name=org.apache.activemq.spring
+logger.spring.level=WARN
+
+#logger.usecases.name=org.apache.activemq.usecases
+#logger.usecases.level=DEBUG
+
+#logger.region.name=org.apache.activemq.broker.region
+#logger.region.level=DEBUG
+
+logger.pool.name=org.apache.activemq.jms.pool
+logger.pool.level=DEBUG
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# RollingFile appender
+appender.logfile.type=RollingRandomAccessFile
+appender.logfile.name=RollingFile
+appender.logfile.fileName=target/activemq-test.log
+appender.logfile.filePattern=target/activemq-test.log.%i
+appender.logfile.append=true
+appender.logfile.layout.type=PatternLayout
+appender.logfile.layout.pattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.logfile.policies.type=Policies
+appender.logfile.policies.size.type=SizeBasedTriggeringPolicy
+appender.logfile.policies.size.size=1MB
diff --git a/activemq-kahadb-store/pom.xml b/activemq-kahadb-store/pom.xml
index 4cef43d73d1..bb555c9a242 100644
--- a/activemq-kahadb-store/pom.xml
+++ b/activemq-kahadb-store/pom.xml
@@ -127,13 +127,8 @@
test
- org.slf4j
- slf4j-log4j12
- test
-
-
- log4j
- log4j
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
diff --git a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java
index b41f3c9a5b3..0033e0b2c74 100644
--- a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java
+++ b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java
@@ -50,13 +50,22 @@
import org.apache.activemq.util.DefaultTestAppender;
import org.apache.activemq.util.IOHelper;
import org.apache.activemq.util.RecoverableRandomAccessFile;
-import org.apache.log4j.Level;
-import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.AppenderRef;
+import org.apache.logging.log4j.core.config.LoggerConfig;
+import org.apache.logging.log4j.core.config.Property;
+import org.apache.logging.log4j.core.filter.AbstractFilter;
+import org.apache.logging.log4j.core.layout.MessageLayout;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.event.LoggingEvent;
public class JournalCorruptionEofIndexRecoveryTest {
@@ -225,23 +234,27 @@ public void testRecoveryAfterCorruptionMetadataLocation() throws Exception {
}
AtomicBoolean trappedExpectedLogMessage = new AtomicBoolean(false);
- DefaultTestAppender appender = new DefaultTestAppender() {
+
+ final var logger = org.apache.logging.log4j.core.Logger.class.cast(LogManager.getRootLogger());
+ final var appender = new AbstractAppender("testAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) {
@Override
- public void doAppend(LoggingEvent event) {
+ public void append(LogEvent event) {
if (event.getLevel() == Level.WARN
- && event.getRenderedMessage().contains("Cannot recover message audit")
- && event.getThrowableInformation().getThrowable().getLocalizedMessage().contains("Invalid location size")) {
+ && event.getMessage().getFormattedMessage().contains("Cannot recover message audit")
+ && event.getThrown().getLocalizedMessage().contains("Invalid location size")) {
trappedExpectedLogMessage.set(true);
}
}
};
- org.apache.log4j.Logger.getRootLogger().addAppender(appender);
-
+ appender.start();
+ logger.addAppender(appender);
+ logger.get().addAppender(appender, Level.INFO, new AbstractFilter() {});
try {
restartBroker(false);
} finally {
- org.apache.log4j.Logger.getRootLogger().removeAppender(appender);
+ logger.removeAppender(appender);
+ logger.get().removeAppender("testAppender");
}
assertEquals("no missing message", 50, broker.getAdminView().getTotalMessageCount());
diff --git a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/page/PageFileTest.java b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/page/PageFileTest.java
index 11b28a8ed2b..7eceef1f7ec 100644
--- a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/page/PageFileTest.java
+++ b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/page/PageFileTest.java
@@ -18,11 +18,14 @@
import junit.framework.TestCase;
import org.apache.activemq.store.kahadb.disk.util.StringMarshaller;
-import org.apache.activemq.util.DefaultTestAppender;
import org.apache.activemq.util.Wait;
-import org.apache.log4j.Appender;
-import org.apache.log4j.Level;
-import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.Property;
+import org.apache.logging.log4j.core.filter.AbstractFilter;
+import org.apache.logging.log4j.core.layout.MessageLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -365,19 +368,19 @@ public void testRecoveryAfterUncleanShutdownAndZeroFreePages() throws Exception
final int numberOfPages = 1000;
final AtomicBoolean recoveryEnd = new AtomicBoolean();
- Appender appender = new DefaultTestAppender() {
+ final var logger = org.apache.logging.log4j.core.Logger.class.cast(LogManager.getLogger(PageFile.class));
+ final var appender = new AbstractAppender("testAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) {
@Override
- public void doAppend(LoggingEvent event) {
- if (event.getLevel().equals(Level.INFO) && event.getMessage().toString().contains("Recovered pageFile free list")) {
+ public void append(LogEvent event) {
+ if (event.toImmutable().getLevel().equals(Level.INFO) && event.toImmutable().getMessage().getFormattedMessage().contains("Recovered pageFile free list")) {
recoveryEnd.set(true);
}
}
};
+ appender.start();
- org.apache.log4j.Logger log4jLogger =
- org.apache.log4j.Logger.getLogger(PageFile.class);
- log4jLogger.addAppender(appender);
- log4jLogger.setLevel(Level.DEBUG);
+ logger.addAppender(appender);
+ logger.get().addAppender(appender, Level.DEBUG, new AbstractFilter() {});
PageFile pf = new PageFile(new File("target/test-data"), getName());
pf.delete();
@@ -415,19 +418,18 @@ public void testBackgroundWillMarkUsedPagesAsFreeInTheBeginning() throws Excepti
final int numberOfPages = 100000;
final AtomicBoolean recoveryEnd = new AtomicBoolean();
- Appender appender = new DefaultTestAppender() {
+ final var logger = org.apache.logging.log4j.core.Logger.class.cast(LogManager.getLogger(PageFile.class));
+ final var appender = new AbstractAppender("pageAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) {
@Override
- public void doAppend(LoggingEvent event) {
- if (event.getLevel().equals(Level.INFO) && event.getMessage().toString().contains("Recovered pageFile free list")) {
+ public void append(LogEvent event) {
+ if (event.toImmutable().getLevel().equals(Level.INFO) && event.toImmutable().getMessage().getFormattedMessage().contains("Recovered pageFile free list")) {
recoveryEnd.set(true);
}
}
};
-
- org.apache.log4j.Logger log4jLogger =
- org.apache.log4j.Logger.getLogger(PageFile.class);
- log4jLogger.addAppender(appender);
- log4jLogger.setLevel(Level.DEBUG);
+ appender.start();
+ logger.addAppender(appender);
+ logger.get().addAppender(appender, Level.DEBUG, new AbstractFilter() {});
PageFile pf = new PageFile(new File("target/test-data"), getName());
pf.delete();
@@ -499,7 +501,7 @@ public boolean isSatisified() throws Exception {
pf2.flush();
long freePages = pf2.getFreePageCount();
LOG.info("free page count: " + freePages);
- return recoveryEnd.get();
+ return recoveryEnd.get();
}
}, 100000));
diff --git a/activemq-kahadb-store/src/test/resources/log4j.properties b/activemq-kahadb-store/src/test/resources/log4j.properties
deleted file mode 100644
index 7cc19418fdc..00000000000
--- a/activemq-kahadb-store/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,42 +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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, out, stdout
-
-#log4j.logger.org.apache.activemq.broker.scheduler=DEBUG
-#log4j.logger.org.apache.activemq.network.DemandForwardingBridgeSupport=DEBUG
-#log4j.logger.org.apache.activemq.transport.failover=TRACE
-#log4j.logger.org.apache.activemq.store.jdbc=TRACE
-#log4j.logger.org.apache.activemq.broker.region.cursors.AbstractStoreCursor=DEBUG
-#log4j.logger.org.apache.activemq.store.jdbc.JDBCMessageStore=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
-#log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
-log4j.appender.out.file=target/activemq-test.log
-log4j.appender.out.append=true
diff --git a/activemq-kahadb-store/src/test/resources/log4j2-test.properties b/activemq-kahadb-store/src/test/resources/log4j2-test.properties
new file mode 100644
index 00000000000..16e203809f0
--- /dev/null
+++ b/activemq-kahadb-store/src/test/resources/log4j2-test.properties
@@ -0,0 +1,58 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests
+#
+rootLogger.level=INFO
+rootLogger.appenderRef.console.ref=Console
+rootLogger.appenderRef.console.filter.threshold.type=ThresholdFilter
+rootLogger.appenderRef.console.filter.threshold.level=INFO
+rootLogger.appenderRef.logfile.ref=RollingFile
+
+#logger.scheduler.name=org.apache.activemq.broker.scheduler
+#logger.scheduler.level=DEBUG
+#logger.network.name=org.apache.activemq.network.DemandForwardingBridgeSupport
+#logger.network.level=DEBUG
+#logger.failover.name=org.apache.activemq.transport.failover
+#logger.failover.level=TRACE
+#logger.jdbc.name=org.apache.activemq.store.jdbc
+#logger.jdbc.level=TRACE
+#logger.cursors.name=org.apache.activemq.broker.region.cursors.AbstractStoreCursor
+#logger.cursors.level=DEBUG
+
+# Appender configuration
+
+# Console appender
+appender.console.type=Console
+appender.console.name=Console
+appender.console.layout.type=PatternLayout
+appender.console.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+#appender.console.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
+
+# RollingFile appender
+appender.logfile.type=RollingRandomAccessFile
+appender.logfile.name=RollingFile
+appender.logfile.fileName=target/activemq-test.log
+appender.logfile.filePattern=target/activemq-test.log.%i
+appender.logfile.append=true
+appender.logfile.layout.type=PatternLayout
+appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %m%n
+#appender.logfile.layout.pattern=%d [%-15.15t] - %-5p %-30.30c{1} - %-10.10X{activemq.broker} %-20.20X{activemq.connector} %-10.10X{activemq.destination} - %m%n
+appender.logfile.policies.type=Policies
+appender.logfile.policies.size.type=SizeBasedTriggeringPolicy
+appender.logfile.policies.size.size=1MB
diff --git a/activemq-karaf/pom.xml b/activemq-karaf/pom.xml
index 7f21cc4af76..c4d087a9bd7 100644
--- a/activemq-karaf/pom.xml
+++ b/activemq-karaf/pom.xml
@@ -46,18 +46,10 @@
org.ops4j.pax.loggingpax-logging-api
- 1.11.4org.ops4j.pax.logging
- pax-logging-service
- 1.11.4
-
-
- log4j
- apache-log4j-extras
-
-
+ pax-logging-log4j2org.slf4j
@@ -65,8 +57,8 @@
test
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
diff --git a/activemq-log4j-appender/pom.xml b/activemq-log4j-appender/pom.xml
index 8c205a789b4..054934be0de 100644
--- a/activemq-log4j-appender/pom.xml
+++ b/activemq-log4j-appender/pom.xml
@@ -36,8 +36,8 @@
activemq-client
- log4j
- log4j
+ org.apache.logging.log4j
+ log4j-coreprovided
@@ -50,8 +50,8 @@
test
- org.slf4j
- slf4j-log4j12
+ org.apache.logging.log4j
+ log4j-slf4j-impltest
@@ -61,8 +61,33 @@
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+
+ log4j-plugin-processor
+
+ compile
+
+ process-classes
+
+ only
+
+ org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor
+
+
+
+
+
+ 1.8
+ 1.8
+
+ maven-jar-plugin
diff --git a/activemq-log4j-appender/src/main/java/org/apache/activemq/util/JmsLogAppenderSupport.java b/activemq-log4j-appender/src/main/java/org/apache/activemq/util/JmsLogAppenderSupport.java
index 9cae3b46c78..60ab31ad64d 100644
--- a/activemq-log4j-appender/src/main/java/org/apache/activemq/util/JmsLogAppenderSupport.java
+++ b/activemq-log4j-appender/src/main/java/org/apache/activemq/util/JmsLogAppenderSupport.java
@@ -16,6 +16,11 @@
*/
package org.apache.activemq.util;
+import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
@@ -28,18 +33,12 @@
import javax.jms.Session;
import javax.naming.NamingException;
-import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.spi.LoggingEvent;
/**
* An abstract base class for implementation inheritence for a log4j JMS
* appender
- *
- *
*/
-public abstract class JmsLogAppenderSupport extends AppenderSkeleton {
-
- public static final int JMS_PUBLISH_ERROR_CODE = 61616;
+public abstract class JmsLogAppenderSupport extends AbstractAppender {
private Connection connection;
private Session session;
@@ -48,6 +47,11 @@ public abstract class JmsLogAppenderSupport extends AppenderSkeleton {
private String subjectPrefix = "log4j.";
public JmsLogAppenderSupport() {
+ this("jmslog", (Filter) null);
+ }
+
+ protected JmsLogAppenderSupport(String name, Filter filter) {
+ super(name, filter, (Layout) null, true);
}
public Connection getConnection() throws JMSException, NamingException {
@@ -108,7 +112,7 @@ public void close() {
}
for (Iterator iter = errors.iterator(); iter.hasNext();) {
JMSException e = iter.next();
- getErrorHandler().error("Error closing JMS resources: " + e, e, JMS_PUBLISH_ERROR_CODE);
+ getHandler().error("Error closing JMS resources: " + e, e);
}
}
@@ -121,7 +125,7 @@ public void activateOptions() {
// lets ensure we're all created
getProducer();
} catch (Exception e) {
- getErrorHandler().error("Could not create JMS resources: " + e, e, JMS_PUBLISH_ERROR_CODE);
+ getHandler().error("Could not create JMS resources: " + e, e);
}
}
@@ -139,7 +143,7 @@ protected MessageProducer createProducer() throws JMSException, NamingException
private static final ThreadLocal