You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/05/13 01:13:35 UTC
[activemq-artemis] branch new-logging updated: more progress
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch new-logging
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/new-logging by this push:
new 8d5c0354a1 more progress
8d5c0354a1 is described below
commit 8d5c0354a1afe29eaa10e3b51778b8e4d1fa83b3
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Thu May 12 21:13:24 2022 -0400
more progress
---
.../activemq/artemis/logprocessor/SimpleBundle.java | 3 +++
.../artemis/logprocessor/SimpleBundleTest.java | 4 ++++
.../core/management/impl/AddressControlImpl.java | 19 +++++++++++--------
.../artemis/core/postoffice/impl/BindingsImpl.java | 2 +-
.../remoting/server/impl/RemotingServiceImpl.java | 2 +-
.../server/cluster/impl/ClusterConnectionImpl.java | 4 +---
.../artemis/core/server/files/FileMoveManager.java | 16 ++++++++--------
.../core/server/group/impl/LocalGroupingHandler.java | 2 +-
.../core/server/impl/ReplicationBackupActivation.java | 16 ++++++++--------
.../server/impl/ReplicationPrimaryActivation.java | 12 ++++++------
.../core/server/impl/SharedNothingLiveActivation.java | 4 +---
.../server/impl/jdbc/ActiveMQScheduledLeaseLock.java | 12 ++++++------
.../core/server/impl/jdbc/JdbcSharedStateManager.java | 4 ++--
.../core/server/management/ManagementConnector.java | 12 ++++++++----
.../artemis/spi/core/protocol/EmbedMessageUtil.java | 2 +-
.../core/security/ActiveMQSecurityManagerImpl.java | 4 +++-
16 files changed, 65 insertions(+), 53 deletions(-)
diff --git a/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java b/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java
index 255df469dd..e98440e88f 100644
--- a/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java
+++ b/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundle.java
@@ -49,4 +49,7 @@ public interface SimpleBundle {
@Message(id = 8, value = "EX{}")
MyException someExceptionWithCause(String message, Exception myCause);
+
+ @Message(id = 9, value = "{} {} {} {} {}")
+ String abcd(String a, String b, String c, String d);
}
diff --git a/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java b/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java
index 2f5ba91fcb..582b35692a 100644
--- a/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java
+++ b/artemis-log-processor/src/test/java/org/apache/activemq/artemis/logprocessor/SimpleBundleTest.java
@@ -69,6 +69,10 @@ public class SimpleBundleTest {
MyException myException = SimpleBundle.MESSAGES.someExceptionWithCause(logRandomString, myCause);
Assert.assertEquals("TST8 EX" + logRandomString, myException.getMessage());
Assert.assertSame(myCause, myException.getCause());
+ }
+ @Test
+ public void testABCD() {
+ Assert.assertEquals("TST9 A B C D", SimpleBundle.MESSAGES.abcd("A", "B", "C", "D"));
}
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
index 2d80ee4543..5826e13549 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
@@ -54,9 +54,12 @@ import org.apache.activemq.artemis.core.server.replay.ReplayManager;
import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.logs.AuditLogger;
import org.apache.activemq.artemis.utils.JsonLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AddressControlImpl extends AbstractControl implements AddressControl {
+ private static final Logger logger = LoggerFactory.getLogger(AddressControlImpl.class);
private AddressInfo addressInfo;
@@ -273,7 +276,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
}
return pagingStore.getAddressSize();
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.debug("Failed to get address size", e);
+ logger.debug("Failed to get address size", e);
return -1;
} finally {
blockOnIO();
@@ -293,7 +296,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
}
pagingStore.getCursorProvider().scheduleCleanup();
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.debug("Failed to schedule pageCleanup", e);
+ logger.debug("Failed to schedule pageCleanup", e);
throw e;
} finally {
blockOnIO();
@@ -354,7 +357,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
}
return pagingStore.getAddressLimitPercent();
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.debug("Failed to get address limit %", e);
+ logger.debug("Failed to get address limit %", e);
return -1;
} finally {
blockOnIO();
@@ -375,7 +378,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
result = true;
}
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.debug("Failed to block", e);
+ logger.debug("Failed to block", e);
} finally {
blockOnIO();
@@ -395,7 +398,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
pagingStore.unblock();
}
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.debug("Failed to unblock", e);
+ logger.debug("Failed to unblock", e);
} finally {
blockOnIO();
}
@@ -416,7 +419,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
return pageStore.getNumberOfPages();
}
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.debug("Failed to get number of pages", e);
+ logger.debug("Failed to get number of pages", e);
return -1;
} finally {
blockOnIO();
@@ -571,7 +574,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
return cache.getMap().size();
}
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.debug("Failed to get duplicate ID cache size", e);
+ logger.debug("Failed to get duplicate ID cache size", e);
}
return 0;
@@ -589,7 +592,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
return true;
}
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.debug("Failed to clear duplicate ID cache", e);
+ logger.debug("Failed to clear duplicate ID cache", e);
}
return false;
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
index f409319651..185d598580 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java
@@ -190,7 +190,7 @@ public final class BindingsImpl implements Bindings {
}
if (logger.isTraceEnabled()) {
- logger.tracef("Redistributing message {}", message);
+ logger.trace("Redistributing message {}", message);
}
final SimpleString routingName = originatingQueue.getName();
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java
index 05b5cfb8bd..01333a41dd 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java
@@ -190,7 +190,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif
return;
}
- logger.tracef("Starting remoting service %s", this);
+ logger.trace("Starting remoting service {}", this);
paused = false;
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
index d166a96143..1a9c9eee3e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
@@ -584,9 +584,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
clusterControl.sendNodeAnnounce(localMember.getUniqueEventID(), manager.getNodeId(), manager.getBackupGroupName(), manager.getScaleDownGroupName(), false, localMember.getLive(), localMember.getBackup());
} catch (ActiveMQException e) {
ActiveMQServerLogger.LOGGER.clusterControlAuthfailure(e.getMessage());
- if (logger.isDebugEnabled()) {
- logger.debug(e);
- }
+ logger.debug(e.getMessage(), e);
}
} else {
ActiveMQServerLogger.LOGGER.noLocalMemborOnClusterConnection(this);
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/files/FileMoveManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/files/FileMoveManager.java
index 845e0fd17b..b8c0935c60 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/files/FileMoveManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/files/FileMoveManager.java
@@ -106,17 +106,17 @@ public class FileMoveManager {
boolean skip = false;
for (String prefixToPreserve : prefixesToPreserve) {
if (fileMove.startsWith(prefixToPreserve)) {
- logger.tracef("skipping %s", fileFrom);
+ logger.trace("skipping {}", fileFrom);
skip = true;
break;
}
}
if (!skip) {
- logger.tracef("deleting %s", fileFrom);
+ logger.trace("deleting {}", fileFrom);
deleteTree(fileFrom);
}
} else {
- logger.tracef("deleting %s", fileFrom);
+ logger.trace("deleting {}", fileFrom);
deleteTree(fileFrom);
}
}
@@ -135,20 +135,20 @@ public class FileMoveManager {
boolean copy = false;
for (String prefixToPreserve : prefixesToPreserve) {
if (fileMove.startsWith(prefixToPreserve)) {
- logger.tracef("skipping %s", fileFrom);
+ logger.trace("skipping {}", fileFrom);
copy = true;
break;
}
}
if (copy) {
- logger.tracef("copying %s to %s", fileFrom, fileTo);
+ logger.trace("copying {} to {}", fileFrom, fileTo);
Files.copy(fileFrom.toPath(), fileTo.toPath());
} else {
- logger.tracef("doMove:: moving %s as %s", fileFrom, fileTo);
+ logger.trace("doMove:: moving {} as {}", fileFrom, fileTo);
Files.move(fileFrom.toPath(), fileTo.toPath());
}
} else {
- logger.tracef("doMove:: moving %s as %s", fileFrom, fileTo);
+ logger.trace("doMove:: moving {} as {}", fileFrom, fileTo);
Files.move(fileFrom.toPath(), fileTo.toPath());
}
}
@@ -173,7 +173,7 @@ public class FileMoveManager {
int foldersToDelete = folders + creating - maxFolders;
if (foldersToDelete > 0) {
- logger.tracef("There are %d folders to delete", foldersToDelete);
+ logger.trace("There are {} folders to delete", foldersToDelete);
int[] ids = getIDlist();
for (int i = 0; i < foldersToDelete; i++) {
File file = getFolder(ids[i]);
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java
index f11cfbbc1c..211347ad84 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java
@@ -231,7 +231,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract {
storageManager.commitBindings(tx);
} catch (Exception e) {
// nothing we can do being log
- ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e);
+ logger.warn(e.getMessage(), e);
}
}
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationBackupActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationBackupActivation.java
index 61af3cd257..e8d064ecfa 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationBackupActivation.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationBackupActivation.java
@@ -207,7 +207,7 @@ public final class ReplicationBackupActivation extends Activation implements Dis
final ClusterController clusterController = activeMQServer.getClusterManager().getClusterController();
- LOGGER.infof("Apache ActiveMQ Artemis Backup Server version %s [%s] started, awaiting connection to a live cluster member to start replication", activeMQServer.getVersion().getFullVersion(),
+ LOGGER.info("Apache ActiveMQ Artemis Backup Server version {} [{}] started, awaiting connection to a live cluster member to start replication", activeMQServer.getVersion().getFullVersion(),
activeMQServer.toString());
clusterController.awaitConnectionToReplicationCluster();
@@ -241,7 +241,7 @@ public final class ReplicationBackupActivation extends Activation implements Dis
nodeManager.stopBackup();
ensureSequentialAccessToNodeData(activeMQServer.toString(), nodeManager, distributedManager, LOGGER);
} catch (Throwable fatal) {
- LOGGER.warn(fatal);
+ LOGGER.warn(fatal.getMessage());
// policy is already live one, but there's no activation yet: we can just stop
asyncRestartServer(activeMQServer, false, false);
throw new ActiveMQIllegalStateException("This server cannot ensure sequential access to broker data: activation is failed");
@@ -262,7 +262,7 @@ public final class ReplicationBackupActivation extends Activation implements Dis
try {
stillLive = liveLock.isHeldByCaller();
} catch (UnavailableStateException e) {
- LOGGER.warn(e);
+ LOGGER.warn(e.getMessage(), e);
primaryActivation.onUnavailableLockEvent();
throw new ActiveMQIllegalStateException("This server cannot check its role as a live: activation is failed");
}
@@ -303,7 +303,7 @@ public final class ReplicationBackupActivation extends Activation implements Dis
}
}
if (expectedNodeID != null) {
- LOGGER.infof("awaiting connecting to any live node with NodeID = %s", expectedNodeID);
+ LOGGER.info("awaiting connecting to any live node with NodeID = {}", expectedNodeID);
}
final ReplicationFailure failure = replicateLive(clusterController, nodeLocator, registrationFailureForwarder);
if (failure == null) {
@@ -313,7 +313,7 @@ public final class ReplicationBackupActivation extends Activation implements Dis
if (!activeMQServer.isStarted()) {
return null;
}
- LOGGER.debugf("ReplicationFailure = %s", failure);
+ LOGGER.debug("ReplicationFailure = {}", failure);
switch (failure) {
case VoluntaryFailOver:
case NonVoluntaryFailover:
@@ -336,7 +336,7 @@ public final class ReplicationBackupActivation extends Activation implements Dis
liveLockWithInSyncReplica = null;
}
} else {
- LOGGER.errorf("Expected positive local activation sequence for NodeID = %s during fail-over, but was %d: restarting as backup",
+ LOGGER.error("Expected positive local activation sequence for NodeID = {} during fail-over, but was {}: restarting as backup",
nodeManager.getNodeId(), nodeManager.getNodeActivationSequence());
}
assert stopping.get();
@@ -367,8 +367,8 @@ public final class ReplicationBackupActivation extends Activation implements Dis
try {
activeMQServer.getNodeManager().setNodeActivationSequence(NULL_NODE_ACTIVATION_SEQUENCE);
} catch (Throwable fatal) {
- LOGGER.errorf(fatal, "Errored while resetting local activation sequence %d for NodeID = %s: stopping broker",
- activationSequence, syncNodeId);
+ LOGGER.error("Errored while resetting local activation sequence {} for NodeID = {}: stopping broker",
+ activationSequence, syncNodeId, fatal);
restart = false;
}
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationPrimaryActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationPrimaryActivation.java
index 88960f75e8..895c2a17e1 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationPrimaryActivation.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationPrimaryActivation.java
@@ -131,7 +131,7 @@ public class ReplicationPrimaryActivation extends LiveActivation implements Dist
}
if (liveLock == null) {
distributedManager.stop();
- LOGGER.infof("This broker cannot become a live server with NodeID = %s: restarting as backup", nodeManager.getNodeId());
+ LOGGER.info("This broker cannot become a live server with NodeID = {}: restarting as backup", nodeManager.getNodeId());
activeMQServer.setHAPolicy(policy.getBackupPolicy());
return;
}
@@ -173,7 +173,7 @@ public class ReplicationPrimaryActivation extends LiveActivation implements Dist
throw new IllegalStateException("NodeManager should be started");
}
final long activationSequence = activeMQServer.getNodeManager().getNodeActivationSequence();
- LOGGER.infof("Applying shared peer NodeID=%s to enable coordinated live activation", coordinationId);
+ LOGGER.info("Applying shared peer NodeID={} to enable coordinated live activation", coordinationId);
// REVISIT: this is quite clunky, also in backup activation, we just need new nodeID persisted!
activeMQServer.resetNodeManager();
final NodeManager nodeManager = activeMQServer.getNodeManager();
@@ -301,14 +301,14 @@ public class ReplicationPrimaryActivation extends LiveActivation implements Dist
}
final ReplicationManager replicationManager = this.replicationManager;
if (replicationManager == null) {
- LOGGER.warnf("Failback interrupted");
+ LOGGER.warn("Failback interrupted");
// we got a disconnection from the replica *before* stopping acceptors: better not failback!
return;
}
// IMPORTANT: this is going to save server::fail to issue a replica connection failure (with failed == false)
// because onReplicationConnectionClose fail-fast on stopping == true.
if (!stoppingServer.compareAndSet(false, true)) {
- LOGGER.infof("Failback interrupted: server is already stopping");
+ LOGGER.info("Failback interrupted: server is already stopping");
return;
}
coordinatedLockAndNodeId = activeMQServer.getNodeManager().getNodeId().toString();
@@ -320,7 +320,7 @@ public class ReplicationPrimaryActivation extends LiveActivation implements Dist
try {
distributedManager.start();
if (!awaitNextCommittedActivationSequence(distributedManager, coordinatedLockAndNodeId, inSyncReplicaActivation, FAILBACK_TIMEOUT_MILLIS, LOGGER)) {
- LOGGER.warnf("Timed out waiting for failback server activation with NodeID = %s: and sequence > %d: after %dms",
+ LOGGER.warn("Timed out waiting for failback server activation with NodeID = {}: and sequence > {}: after {}ms",
coordinatedLockAndNodeId, inSyncReplicaActivation, FAILBACK_TIMEOUT_MILLIS);
}
} catch (UnavailableStateException ignored) {
@@ -388,7 +388,7 @@ public class ReplicationPrimaryActivation extends LiveActivation implements Dist
try {
ensureSequentialAccessToNodeData(activeMQServer.toString(), activeMQServer.getNodeManager(), distributedManager, LOGGER);
} catch (Throwable fatal) {
- LOGGER.errorf(fatal, "Unexpected exception: %s on attempted activation sequence increment; stopping server async", fatal.getLocalizedMessage());
+ LOGGER.error("Unexpected exception: {} on attempted activation sequence increment; stopping server async", fatal.getLocalizedMessage(), fatal);
asyncStopServer();
}
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
index b356cb2d4b..24ed76f354 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
@@ -103,15 +103,13 @@ public class SharedNothingLiveActivation extends LiveActivation {
if (replicatedPolicy.isCheckForLiveServer() && isNodeIdUsed()) {
//set for when we failback
if (logger.isTraceEnabled()) {
- logger.tracef("@@@ setting up replicatedPolicy.getReplicaPolicy for back start, replicaPolicy::%s, isBackup=%s, server=%s", replicatedPolicy.getReplicaPolicy(), replicatedPolicy.isBackup(), activeMQServer);
+ logger.trace("setting up replicatedPolicy.getReplicaPolicy for back start, replicaPolicy::{}, isBackup={}, server={}", replicatedPolicy.getReplicaPolicy(), replicatedPolicy.isBackup(), activeMQServer);
}
replicatedPolicy.getReplicaPolicy().setReplicatedPolicy(replicatedPolicy);
activeMQServer.setHAPolicy(replicatedPolicy.getReplicaPolicy());
return;
}
- logger.trace("@@@ did not do it now");
-
activeMQServer.initialisePart1(false);
activeMQServer.getClusterManager().getQuorumManager().registerQuorumHandler(new ServerConnectVoteHandler(activeMQServer));
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java
index 41041c4a8f..1377d061c2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/ActiveMQScheduledLeaseLock.java
@@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
*/
final class ActiveMQScheduledLeaseLock extends ActiveMQScheduledComponent implements ScheduledLeaseLock {
- private static final Logger LOGGER = LoggerFactory.getLogger(ActiveMQScheduledLeaseLock.class);
+ private static final Logger logger = LoggerFactory.getLogger(ActiveMQScheduledLeaseLock.class);
private final String lockName;
private final LeaseLock lock;
@@ -100,7 +100,7 @@ final class ActiveMQScheduledLeaseLock extends ActiveMQScheduledComponent implem
try {
lockLost = !this.lock.renew();
} catch (Throwable t) {
- LOGGER.warnf(t, "%s lock renew has failed", lockName);
+ logger.warn("{} lock renew has failed", lockName, t);
if (lock.localExpirationTime() > 0) {
final long millisBeforeExpiration = (lock.localExpirationTime() - System.currentTimeMillis());
// there is enough time to retry to renew it?
@@ -114,7 +114,7 @@ final class ActiveMQScheduledLeaseLock extends ActiveMQScheduledComponent implem
try {
lockListener.lostLock();
} catch (Throwable t) {
- LOGGER.warnf(t, "Errored while notifying %s lock listener", lockName);
+ logger.warn("Errored while notifying {} lock listener", lockName, t);
}
}
//logic to detect slowness of DB and/or the scheduled executor service
@@ -131,14 +131,14 @@ final class ActiveMQScheduledLeaseLock extends ActiveMQScheduledComponent implem
long expirationMillis) {
final long elapsedMillisToRenew = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - renewStart);
if (elapsedMillisToRenew > expectedRenewPeriodMillis) {
- LOGGER.errorf("%s lock %s renew tooks %d ms, while is supposed to take <%d ms", lockName, lostLock ? "failed" : "successful", elapsedMillisToRenew, expectedRenewPeriodMillis);
+ logger.error("{} lock {} renew tooks {} ms, while is supposed to take <{} ms", lockName, lostLock ? "failed" : "successful", elapsedMillisToRenew, expectedRenewPeriodMillis);
}
final long measuredRenewPeriodNanos = renewStart - lastRenewStart;
final long measuredRenewPeriodMillis = TimeUnit.NANOSECONDS.toMillis(measuredRenewPeriodNanos);
if (measuredRenewPeriodMillis - expirationMillis > 100) {
- LOGGER.errorf("%s lock %s renew period lasted %d ms instead of %d ms", lockName, lostLock ? "failed" : "successful", measuredRenewPeriodMillis, expectedRenewPeriodMillis);
+ logger.error("{} lock {} renew period lasted {} ms instead of {} ms", lockName, lostLock ? "failed" : "successful", measuredRenewPeriodMillis, expectedRenewPeriodMillis);
} else if (measuredRenewPeriodMillis - expectedRenewPeriodMillis > 100) {
- LOGGER.warnf("%s lock %s renew period lasted %d ms instead of %d ms", lockName, lostLock ? "failed" : "successful", measuredRenewPeriodMillis, expectedRenewPeriodMillis);
+ logger.warn("{} lock {} renew period lasted {} ms instead of {} ms", lockName, lostLock ? "failed" : "successful", measuredRenewPeriodMillis, expectedRenewPeriodMillis);
}
}
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcSharedStateManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcSharedStateManager.java
index b27f858076..8d77cef86e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcSharedStateManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcSharedStateManager.java
@@ -261,12 +261,12 @@ final class JdbcSharedStateManager extends AbstractJDBCDriver implements SharedS
} else {
//rawInitializeNodeId has failed just due to contention or nodeId wasn't committed yet
connection.rollback();
- logger.debugf("Rollback after failed to update NodeId to %s and haven't found any NodeId", newNodeId);
+ logger.debug("Rollback after failed to update NodeId to {} and haven't found any NodeId", newNodeId);
return null;
}
} catch (SQLException e) {
connection.rollback();
- logger.debugf(e, "Rollback while trying to update NodeId to %s", newNodeId);
+ logger.debug("Rollback while trying to update NodeId to {}", newNodeId, e);
return null;
} finally {
connection.setAutoCommit(autoCommit);
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementConnector.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementConnector.java
index c2127759ce..0454cab6c2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementConnector.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementConnector.java
@@ -21,6 +21,8 @@ import org.apache.activemq.artemis.core.server.ActiveMQComponent;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.spi.core.security.ActiveMQBasicSecurityManager;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -31,6 +33,8 @@ import java.util.Map;
public class ManagementConnector implements ActiveMQComponent {
+ private static final Logger logger = LoggerFactory.getLogger(ManagementConnector.class);
+
private final JMXConnectorConfiguration configuration;
private ConnectorServerFactory connectorServerFactory;
private RmiRegistryFactory rmiRegistryFactory;
@@ -90,7 +94,7 @@ public class ManagementConnector implements ActiveMQComponent {
connectorServerFactory.setTrustStorePassword(configuration.getTrustStorePassword());
connectorServerFactory.init();
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.error("Can't init JMXConnectorServer: " + e.getMessage());
+ logger.error("Can't init JMXConnectorServer: " + e.getMessage(), e);
}
}
@@ -100,7 +104,7 @@ public class ManagementConnector implements ActiveMQComponent {
try {
connectorServerFactory.destroy();
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.warn("Error destroying ConnectorServerFactory", e);
+ logger.warn("Error destroying ConnectorServerFactory", e);
}
connectorServerFactory = null;
}
@@ -108,7 +112,7 @@ public class ManagementConnector implements ActiveMQComponent {
try {
mbeanServerFactory.destroy();
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.warn("Error destroying MBeanServerFactory", e);
+ logger.warn("Error destroying MBeanServerFactory", e);
}
mbeanServerFactory = null;
}
@@ -116,7 +120,7 @@ public class ManagementConnector implements ActiveMQComponent {
try {
rmiRegistryFactory.destroy();
} catch (Exception e) {
- ActiveMQServerLogger.LOGGER.warn("Error destroying RMIRegistryFactory", e);
+ logger.warn("Error destroying RMIRegistryFactory", e);
}
rmiRegistryFactory = null;
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/EmbedMessageUtil.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/EmbedMessageUtil.java
index 62cba921ec..501f8bfef7 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/EmbedMessageUtil.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/EmbedMessageUtil.java
@@ -87,7 +87,7 @@ public class EmbedMessageUtil {
ActiveMQBuffer buffer = message.getReadOnlyBodyBuffer();
if (buffer.readableBytes() < signature.length || !checkSignature(buffer)) {
- logger.tracef("Message type %d was used for something other than embed messages, ignoring content and treating as a regular message", Message.EMBEDDED_TYPE);
+ logger.trace("Message type {} was used for something other than embed messages, ignoring content and treating as a regular message", Message.EMBEDDED_TYPE);
return message;
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
index 54f23bc557..2d92ba6080 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQSecurityManagerImpl.java
@@ -24,6 +24,8 @@ import org.apache.activemq.artemis.core.security.CheckType;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.security.User;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A basic implementation of the ActiveMQSecurityManager. This can be used within an appserver and be deployed by
@@ -34,7 +36,7 @@ public class ActiveMQSecurityManagerImpl implements ActiveMQSecurityManager {
private final SecurityConfiguration configuration;
- private ActiveMQServerLogger logger = ActiveMQServerLogger.LOGGER;
+ private static final Logger logger = LoggerFactory.getLogger(ActiveMQSecurityManagerImpl.class);
public ActiveMQSecurityManagerImpl() {
configuration = new SecurityConfiguration();