Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5E688200AE8 for ; Tue, 3 May 2016 11:55:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5D2F11609F5; Tue, 3 May 2016 11:55:29 +0200 (CEST) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B6B921609F3 for ; Tue, 3 May 2016 11:55:27 +0200 (CEST) Received: (qmail 97338 invoked by uid 500); 3 May 2016 09:55:26 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 97329 invoked by uid 99); 3 May 2016 09:55:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2016 09:55:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BD871DFB79; Tue, 3 May 2016 09:55:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: andytaylor@apache.org To: commits@activemq.apache.org Date: Tue, 03 May 2016 09:55:26 -0000 Message-Id: <4f40df6cce4e4ee7a2dcca54b71d0ab0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/6] activemq-artemis git commit: Individualizing logger.traces on org.apache.activemq.artemis.core.server (artemis-server project) archived-at: Tue, 03 May 2016 09:55:29 -0000 Repository: activemq-artemis Updated Branches: refs/heads/master 2135911ea -> 882b8edbd http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java index 2807aff..18a2105 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java @@ -33,9 +33,12 @@ import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy; import org.apache.activemq.artemis.core.server.group.GroupingHandler; import org.apache.activemq.artemis.core.server.management.ManagementService; +import org.jboss.logging.Logger; public final class SharedStoreBackupActivation extends Activation { + private static final Logger logger = Logger.getLogger(SharedStoreBackupActivation.class); + //this is how we act as a backup private SharedStoreSlavePolicy sharedStoreSlavePolicy; @@ -215,7 +218,7 @@ public final class SharedStoreBackupActivation extends Activation { @Override public void run() { try { - ActiveMQServerLogger.LOGGER.debug(activeMQServer + "::Stopping live node in favor of failback"); + logger.debug(activeMQServer + "::Stopping live node in favor of failback"); NodeManager nodeManager = activeMQServer.getNodeManager(); activeMQServer.stop(true, false, true); @@ -230,7 +233,7 @@ public final class SharedStoreBackupActivation extends Activation { return; activeMQServer.setHAPolicy(sharedStoreSlavePolicy); - ActiveMQServerLogger.LOGGER.debug(activeMQServer + "::Starting backup node now after failback"); + logger.debug(activeMQServer + "::Starting backup node now after failback"); activeMQServer.start(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreLiveActivation.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreLiveActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreLiveActivation.java index 8cdcb91..ff688d1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreLiveActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreLiveActivation.java @@ -19,9 +19,12 @@ package org.apache.activemq.artemis.core.server.impl; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreMasterPolicy; +import org.jboss.logging.Logger; public final class SharedStoreLiveActivation extends LiveActivation { + private static final Logger logger = Logger.getLogger(SharedStoreLiveActivation.class); + //this is how we act when we initially start as live private SharedStoreMasterPolicy sharedStoreMasterPolicy; @@ -39,8 +42,8 @@ public final class SharedStoreLiveActivation extends LiveActivation { activeMQServer.checkJournalDirectory(); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("First part initialization on " + this); + if (logger.isDebugEnabled()) { + logger.debug("First part initialization on " + this); } if (!activeMQServer.initialisePart1(false)) @@ -51,8 +54,8 @@ public final class SharedStoreLiveActivation extends LiveActivation { * looks like we've failed over at some point need to inform that we are the backup * so when the current live goes down they failover to us */ - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("announcing backup to the former live" + this); + if (logger.isDebugEnabled()) { + logger.debug("announcing backup to the former live" + this); } activeMQServer.getBackupManager().start(); activeMQServer.getBackupManager().announceBackup(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/TransientQueueManagerImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/TransientQueueManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/TransientQueueManagerImpl.java index 1b7011c..6a491a5 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/TransientQueueManagerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/TransientQueueManagerImpl.java @@ -22,9 +22,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.TransientQueueManager; import org.apache.activemq.artemis.utils.ReferenceCounterUtil; +import org.jboss.logging.Logger; public class TransientQueueManagerImpl implements TransientQueueManager { + private static final Logger logger = Logger.getLogger(TransientQueueManagerImpl.class); + private final SimpleString queueName; private final ActiveMQServer server; @@ -33,8 +36,8 @@ public class TransientQueueManagerImpl implements TransientQueueManager { @Override public void run() { try { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("deleting temporary queue " + queueName); + if (logger.isDebugEnabled()) { + logger.debug("deleting temporary queue " + queueName); } try { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java index a65498d..8187809 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java @@ -49,12 +49,12 @@ import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.config.DivertConfiguration; import org.apache.activemq.artemis.core.management.impl.AcceptorControlImpl; +import org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl; import org.apache.activemq.artemis.core.management.impl.AddressControlImpl; import org.apache.activemq.artemis.core.management.impl.BridgeControlImpl; import org.apache.activemq.artemis.core.management.impl.BroadcastGroupControlImpl; import org.apache.activemq.artemis.core.management.impl.ClusterConnectionControlImpl; import org.apache.activemq.artemis.core.management.impl.DivertControlImpl; -import org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl; import org.apache.activemq.artemis.core.management.impl.QueueControlImpl; import org.apache.activemq.artemis.core.messagecounter.MessageCounter; import org.apache.activemq.artemis.core.messagecounter.MessageCounterManager; @@ -65,10 +65,10 @@ import org.apache.activemq.artemis.core.postoffice.PostOffice; import org.apache.activemq.artemis.core.remoting.server.RemotingService; import org.apache.activemq.artemis.core.security.Role; import org.apache.activemq.artemis.core.security.SecurityStore; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; -import org.apache.activemq.artemis.core.server.Divert; import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; import org.apache.activemq.artemis.core.server.ActiveMQServer; +import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; +import org.apache.activemq.artemis.core.server.Divert; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.QueueFactory; import org.apache.activemq.artemis.core.server.ServerMessage; @@ -85,11 +85,12 @@ import org.apache.activemq.artemis.core.transaction.ResourceManager; import org.apache.activemq.artemis.spi.core.remoting.Acceptor; import org.apache.activemq.artemis.utils.ConcurrentHashSet; import org.apache.activemq.artemis.utils.TypedProperties; +import org.jboss.logging.Logger; public class ManagementServiceImpl implements ManagementService { // Constants ----------------------------------------------------- - private static final boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(ManagementServiceImpl.class); private final MBeanServer mbeanServer; @@ -217,8 +218,8 @@ public class ManagementServiceImpl implements ManagementService { registerInRegistry(ResourceNames.CORE_ADDRESS + address, addressControl); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("registered address " + objectName); + if (logger.isDebugEnabled()) { + logger.debug("registered address " + objectName); } } @@ -244,8 +245,8 @@ public class ManagementServiceImpl implements ManagementService { registerInJMX(objectName, queueControl); registerInRegistry(ResourceNames.CORE_QUEUE + queue.getName(), queueControl); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("registered queue " + objectName); + if (logger.isDebugEnabled()) { + logger.debug("registered queue " + objectName); } } @@ -264,8 +265,8 @@ public class ManagementServiceImpl implements ManagementService { registerInJMX(objectName, new StandardMBean(divertControl, DivertControl.class)); registerInRegistry(ResourceNames.CORE_DIVERT + config.getName(), divertControl); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("registered divert " + objectName); + if (logger.isDebugEnabled()) { + logger.debug("registered divert " + objectName); } } @@ -369,8 +370,8 @@ public class ManagementServiceImpl implements ManagementService { ServerMessage reply = new ServerMessageImpl(storageManager.generateID(), 512); String resourceName = message.getStringProperty(ManagementHelper.HDR_RESOURCE_NAME); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("handling management message for " + resourceName); + if (logger.isDebugEnabled()) { + logger.debug("handling management message for " + resourceName); } String operation = message.getStringProperty(ManagementHelper.HDR_OPERATION_NAME); @@ -601,8 +602,8 @@ public class ManagementServiceImpl implements ManagementService { @Override public void sendNotification(final Notification notification) throws Exception { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("Sending Notification = " + notification + + if (logger.isTraceEnabled()) { + logger.trace("Sending Notification = " + notification + ", notificationEnabled=" + notificationsEnabled + " messagingServerControl=" + messagingServerControl); } @@ -629,8 +630,8 @@ public class ManagementServiceImpl implements ManagementService { // Note at backup initialisation we don't want to send notifications either // https://jira.jboss.org/jira/browse/HORNETQ-317 if (messagingServer == null || !messagingServer.isActive()) { - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("ignoring message " + notification + " as the server is not initialized"); + if (logger.isDebugEnabled()) { + logger.debug("ignoring message " + notification + " as the server is not initialized"); } return; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java index ad375c4..5ec898e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java @@ -34,12 +34,15 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.settings.HierarchicalRepository; import org.apache.activemq.artemis.core.settings.HierarchicalRepositoryChangeListener; import org.apache.activemq.artemis.core.settings.Mergeable; +import org.jboss.logging.Logger; /** * allows objects to be mapped against a regex pattern and held in order in a list */ public class HierarchicalObjectRepository implements HierarchicalRepository { + private static final Logger logger = Logger.getLogger(HierarchicalObjectRepository.class); + private boolean listenersEnabled = true; /** * The default Match to fall back to @@ -248,7 +251,7 @@ public class HierarchicalObjectRepository implements HierarchicalRepository operations; @@ -174,19 +175,19 @@ public class TransactionImpl implements Transaction { @Override public void prepare() throws Exception { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("TransactionImpl::prepare::" + this); + if (logger.isTraceEnabled()) { + logger.trace("TransactionImpl::prepare::" + this); } storageManager.readLock(); try { synchronized (timeoutLock) { if (isEffective()) { - ActiveMQServerLogger.LOGGER.debug("TransactionImpl::prepare::" + this + " is being ignored"); + logger.debug("TransactionImpl::prepare::" + this + " is being ignored"); return; } if (state == State.ROLLBACK_ONLY) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("TransactionImpl::prepare::rollbackonly, rollingback " + this); + if (logger.isTraceEnabled()) { + logger.trace("TransactionImpl::prepare::rollbackonly, rollingback " + this); } internalRollback(); @@ -241,13 +242,13 @@ public class TransactionImpl implements Transaction { @Override public void commit(final boolean onePhase) throws Exception { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("TransactionImpl::commit::" + this); + if (logger.isTraceEnabled()) { + logger.trace("TransactionImpl::commit::" + this); } synchronized (timeoutLock) { if (state == State.COMMITTED) { // I don't think this could happen, but just in case - ActiveMQServerLogger.LOGGER.debug("TransactionImpl::commit::" + this + " is being ignored"); + logger.debug("TransactionImpl::commit::" + this + " is being ignored"); return; } if (state == State.ROLLBACK_ONLY) { @@ -318,14 +319,14 @@ public class TransactionImpl implements Transaction { @Override public void rollback() throws Exception { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("TransactionImpl::rollback::" + this); + if (logger.isTraceEnabled()) { + logger.trace("TransactionImpl::rollback::" + this); } synchronized (timeoutLock) { if (state == State.ROLLEDBACK) { // I don't think this could happen, but just in case - ActiveMQServerLogger.LOGGER.debug("TransactionImpl::rollback::" + this + " is being ignored"); + logger.debug("TransactionImpl::rollback::" + this + " is being ignored"); return; } if (xid != null) { @@ -344,8 +345,8 @@ public class TransactionImpl implements Transaction { } private void internalRollback() throws Exception { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("TransactionImpl::internalRollback " + this); + if (logger.isTraceEnabled()) { + logger.trace("TransactionImpl::internalRollback " + this); } beforeRollback(); @@ -419,17 +420,17 @@ public class TransactionImpl implements Transaction { @Override public void markAsRollbackOnly(final ActiveMQException exception) { synchronized (timeoutLock) { - if (isTrace) { - ActiveMQServerLogger.LOGGER.trace("TransactionImpl::" + this + " marking rollbackOnly for " + exception.toString() + ", msg=" + exception.getMessage()); + if (logger.isTraceEnabled()) { + logger.trace("TransactionImpl::" + this + " marking rollbackOnly for " + exception.toString() + ", msg=" + exception.getMessage()); } if (isEffective()) { - ActiveMQServerLogger.LOGGER.debug("Trying to mark transaction " + this.id + " xid=" + this.xid + " as rollbackOnly but it was already effective (prepared, committed or rolledback!)"); + logger.debug("Trying to mark transaction " + this.id + " xid=" + this.xid + " as rollbackOnly but it was already effective (prepared, committed or rolledback!)"); return; } - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Marking Transaction " + this.id + " as rollback only"); + if (logger.isDebugEnabled()) { + logger.debug("Marking Transaction " + this.id + " as rollback only"); } state = State.ROLLBACK_ONLY; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java index c814600..d076071 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java @@ -29,11 +29,11 @@ import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration; import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection; import org.apache.activemq.artemis.core.security.CheckType; import org.apache.activemq.artemis.core.security.Role; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.security.jaas.JaasCallbackHandler; import org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal; import org.apache.activemq.artemis.utils.CertificateUtil; +import org.jboss.logging.Logger; /** * This implementation delegates to the JAAS security interfaces. @@ -43,7 +43,7 @@ import org.apache.activemq.artemis.utils.CertificateUtil; */ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 { - private final boolean trace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); + private static final Logger logger = Logger.getLogger(ActiveMQJAASSecurityManager.class); private String configurationName; private SecurityConfiguration configuration; @@ -72,7 +72,7 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 { return true; } catch (LoginException e) { - ActiveMQServerLogger.LOGGER.debug("Couldn't validate user", e); + logger.debug("Couldn't validate user", e); return false; } } @@ -98,7 +98,7 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 { localSubject = getAuthenticatedSubject(user, password, certificates); } catch (LoginException e) { - ActiveMQServerLogger.LOGGER.debug("Couldn't validate user", e); + logger.debug("Couldn't validate user", e); return false; } @@ -121,8 +121,8 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 { } } - if (trace) { - ActiveMQServerLogger.LOGGER.trace("user " + (authorized ? " is " : " is NOT ") + "authorized"); + if (logger.isTraceEnabled()) { + logger.trace("user " + (authorized ? " is " : " is NOT ") + "authorized"); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/CertificateLoginModule.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/CertificateLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/CertificateLoginModule.java index e21fc39..232fc6e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/CertificateLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/CertificateLoginModule.java @@ -30,7 +30,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; +import org.jboss.logging.Logger; /** * A LoginModule that allows for authentication based on SSL certificates. @@ -39,6 +39,8 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; */ public abstract class CertificateLoginModule extends PropertiesLoader implements LoginModule { + private static final Logger logger = Logger.getLogger(CertificateLoginModule.class); + private CallbackHandler callbackHandler; private Subject subject; @@ -82,7 +84,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements } if (debug) { - ActiveMQServerLogger.LOGGER.debug("Certificate for user: " + username); + logger.debug("Certificate for user: " + username); } return true; } @@ -103,7 +105,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements clear(); if (debug) { - ActiveMQServerLogger.LOGGER.debug("commit"); + logger.debug("commit"); } return true; } @@ -116,7 +118,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements clear(); if (debug) { - ActiveMQServerLogger.LOGGER.debug("abort"); + logger.debug("abort"); } return true; } @@ -130,7 +132,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements principals.clear(); if (debug) { - ActiveMQServerLogger.LOGGER.debug("logout"); + logger.debug("logout"); } return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java index e99f072..18bae34 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java @@ -29,7 +29,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; +import org.jboss.logging.Logger; /** * Always login the user with a default 'guest' identity. @@ -40,6 +40,8 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; */ public class GuestLoginModule implements LoginModule { + private static final Logger logger = Logger.getLogger(GuestLoginModule.class); + private static final String GUEST_USER = "org.apache.activemq.jaas.guest.user"; private static final String GUEST_ROLE = "org.apache.activemq.jaas.guest.role"; @@ -68,7 +70,7 @@ public class GuestLoginModule implements LoginModule { principals.add(new RolePrincipal(roleName)); if (debug) { - ActiveMQServerLogger.LOGGER.debug("Initialized debug=" + debug + " guestUser=" + userName + " guestGroup=" + roleName); + logger.debug("Initialized debug=" + debug + " guestUser=" + userName + " guestGroup=" + roleName); } } @@ -82,7 +84,7 @@ public class GuestLoginModule implements LoginModule { callbackHandler.handle(new Callback[]{passwordCallback}); if (passwordCallback.getPassword() != null) { if (debug) { - ActiveMQServerLogger.LOGGER.debug("Guest login failing (credentialsInvalidate=true) on presence of a password"); + logger.debug("Guest login failing (credentialsInvalidate=true) on presence of a password"); } loginSucceeded = false; passwordCallback.clearPassword(); @@ -94,7 +96,7 @@ public class GuestLoginModule implements LoginModule { } } if (debug) { - ActiveMQServerLogger.LOGGER.debug("Guest login " + loginSucceeded); + logger.debug("Guest login " + loginSucceeded); } return loginSucceeded; } @@ -106,7 +108,7 @@ public class GuestLoginModule implements LoginModule { } if (debug) { - ActiveMQServerLogger.LOGGER.debug("commit: " + loginSucceeded); + logger.debug("commit: " + loginSucceeded); } return loginSucceeded; } @@ -115,7 +117,7 @@ public class GuestLoginModule implements LoginModule { public boolean abort() throws LoginException { if (debug) { - ActiveMQServerLogger.LOGGER.debug("abort"); + logger.debug("abort"); } return true; } @@ -125,7 +127,7 @@ public class GuestLoginModule implements LoginModule { subject.getPrincipals().removeAll(principals); if (debug) { - ActiveMQServerLogger.LOGGER.debug("logout"); + logger.debug("logout"); } return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java index 2fc23c0..49bd24f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java @@ -33,9 +33,12 @@ import java.util.Map; import java.util.Set; import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; +import org.jboss.logging.Logger; public class InVMLoginModule implements LoginModule { + + private static final Logger logger = Logger.getLogger(InVMLoginModule.class); + public static final String CONFIG_PROP_NAME = "org.apache.activemq.jaas.invm.config"; private SecurityConfiguration configuration; @@ -92,7 +95,7 @@ public class InVMLoginModule implements LoginModule { } loginSucceeded = true; - ActiveMQServerLogger.LOGGER.debug("login " + user); + logger.debug("login " + user); return loginSucceeded; } @@ -117,7 +120,7 @@ public class InVMLoginModule implements LoginModule { // will whack loginSucceeded clear(); - ActiveMQServerLogger.LOGGER.debug("commit, result: " + result); + logger.debug("commit, result: " + result); return result; } @@ -126,7 +129,7 @@ public class InVMLoginModule implements LoginModule { public boolean abort() throws LoginException { clear(); - ActiveMQServerLogger.LOGGER.debug("abort"); + logger.debug("abort"); return true; } @@ -142,7 +145,7 @@ public class InVMLoginModule implements LoginModule { principals.clear(); clear(); - ActiveMQServerLogger.LOGGER.debug("logout"); + logger.debug("logout"); return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java index 512f02e..386d536 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java @@ -53,9 +53,12 @@ import java.util.Queue; import java.util.Set; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; +import org.jboss.logging.Logger; public class LDAPLoginModule implements LoginModule { + private static final Logger logger = Logger.getLogger(LDAPLoginModule.class); + private static final String INITIAL_CONTEXT_FACTORY = "initialContextFactory"; private static final String CONNECTION_URL = "connectionURL"; private static final String CONNECTION_USERNAME = "connectionUsername"; @@ -161,8 +164,8 @@ public class LDAPLoginModule implements LoginModule { DirContext context = null; - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Create the LDAP initial context."); + if (logger.isDebugEnabled()) { + logger.debug("Create the LDAP initial context."); } try { context = open(); @@ -199,11 +202,11 @@ public class LDAPLoginModule implements LoginModule { list.toArray(attribs); constraints.setReturningAttributes(attribs); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Get the user DN."); - ActiveMQServerLogger.LOGGER.debug("Looking for the user in LDAP with "); - ActiveMQServerLogger.LOGGER.debug(" base DN: " + getLDAPPropertyValue(USER_BASE)); - ActiveMQServerLogger.LOGGER.debug(" filter: " + filter); + if (logger.isDebugEnabled()) { + logger.debug("Get the user DN."); + logger.debug("Looking for the user in LDAP with "); + logger.debug(" base DN: " + getLDAPPropertyValue(USER_BASE)); + logger.debug(" filter: " + filter); } NamingEnumeration results = context.search(getLDAPPropertyValue(USER_BASE), filter, constraints); @@ -221,7 +224,7 @@ public class LDAPLoginModule implements LoginModule { String dn; if (result.isRelative()) { - ActiveMQServerLogger.LOGGER.debug("LDAP returned a relative name: " + result.getName()); + logger.debug("LDAP returned a relative name: " + result.getName()); NameParser parser = context.getNameParser(""); Name contextName = parser.parse(context.getNameInNamespace()); @@ -232,7 +235,7 @@ public class LDAPLoginModule implements LoginModule { dn = name.toString(); } else { - ActiveMQServerLogger.LOGGER.debug("LDAP returned an absolute name: " + result.getName()); + logger.debug("LDAP returned an absolute name: " + result.getName()); try { URI uri = new URI(result.getName()); @@ -253,8 +256,8 @@ public class LDAPLoginModule implements LoginModule { } } - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Using DN [" + dn + "] for binding."); + if (logger.isDebugEnabled()) { + logger.debug("Using DN [" + dn + "] for binding."); } Attributes attrs = result.getAttributes(); @@ -270,8 +273,8 @@ public class LDAPLoginModule implements LoginModule { if (bindUser(context, dn, password)) { // if authenticated add more roles roles = getRoles(context, dn, username, roles); - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Roles " + roles + " for user " + username); + if (logger.isDebugEnabled()) { + logger.debug("Roles " + roles + " for user " + username); } for (int i = 0; i < roles.size(); i++) { groups.add(new RolePrincipal(roles.get(i))); @@ -323,11 +326,11 @@ public class LDAPLoginModule implements LoginModule { else { constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE); } - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Get user roles."); - ActiveMQServerLogger.LOGGER.debug("Looking for the user roles in LDAP with "); - ActiveMQServerLogger.LOGGER.debug(" base DN: " + getLDAPPropertyValue(ROLE_BASE)); - ActiveMQServerLogger.LOGGER.debug(" filter: " + filter); + if (logger.isDebugEnabled()) { + logger.debug("Get user roles."); + logger.debug("Looking for the user roles in LDAP with "); + logger.debug(" base DN: " + getLDAPPropertyValue(ROLE_BASE)); + logger.debug(" filter: " + filter); } HashSet haveSeenNames = new HashSet<>(); Queue pendingNameExpansion = new LinkedList<>(); @@ -396,22 +399,22 @@ public class LDAPLoginModule implements LoginModule { protected boolean bindUser(DirContext context, String dn, String password) throws NamingException { boolean isValid = false; - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Binding the user."); + if (logger.isDebugEnabled()) { + logger.debug("Binding the user."); } context.addToEnvironment(Context.SECURITY_PRINCIPAL, dn); context.addToEnvironment(Context.SECURITY_CREDENTIALS, password); try { context.getAttributes("", null); isValid = true; - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("User " + dn + " successfully bound."); + if (logger.isDebugEnabled()) { + logger.debug("User " + dn + " successfully bound."); } } catch (AuthenticationException e) { isValid = false; - if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) { - ActiveMQServerLogger.LOGGER.debug("Authentication failed for dn=" + dn); + if (logger.isDebugEnabled()) { + logger.debug("Authentication failed for dn=" + dn); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoader.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoader.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoader.java index ba8839a..863b021 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoader.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoader.java @@ -20,17 +20,19 @@ import java.io.File; import java.util.HashMap; import java.util.Map; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; +import org.jboss.logging.Logger; public class PropertiesLoader { + private static final Logger logger = Logger.getLogger(PropertiesLoader.class); + static Map staticCache = new HashMap<>(); protected boolean debug; public void init(Map options) { debug = booleanOption("debug", options); if (debug) { - ActiveMQServerLogger.LOGGER.debug("Initialized debug"); + logger.debug("Initialized debug"); } } @@ -111,7 +113,7 @@ public class PropertiesLoader { } } if (debug) { - ActiveMQServerLogger.LOGGER.debug("Using basedir=" + baseDir.getAbsolutePath()); + logger.debug("Using basedir=" + baseDir.getAbsolutePath()); } return baseDir; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoginModule.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoginModule.java index 61e1aa5..709c510 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoginModule.java @@ -32,10 +32,12 @@ import java.util.Map; import java.util.Properties; import java.util.Set; -import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; +import org.jboss.logging.Logger; public class PropertiesLoginModule extends PropertiesLoader implements LoginModule { + private static final Logger logger = Logger.getLogger(PropertiesLoginModule.class); + private static final String USER_FILE_PROP_NAME = "org.apache.activemq.jaas.properties.user"; private static final String ROLE_FILE_PROP_NAME = "org.apache.activemq.jaas.properties.role"; @@ -96,7 +98,7 @@ public class PropertiesLoginModule extends PropertiesLoader implements LoginModu loginSucceeded = true; if (debug) { - ActiveMQServerLogger.LOGGER.debug("login " + user); + logger.debug("login " + user); } return loginSucceeded; } @@ -121,7 +123,7 @@ public class PropertiesLoginModule extends PropertiesLoader implements LoginModu clear(); if (debug) { - ActiveMQServerLogger.LOGGER.debug("commit, result: " + result); + logger.debug("commit, result: " + result); } return result; } @@ -131,7 +133,7 @@ public class PropertiesLoginModule extends PropertiesLoader implements LoginModu clear(); if (debug) { - ActiveMQServerLogger.LOGGER.debug("abort"); + logger.debug("abort"); } return true; } @@ -142,7 +144,7 @@ public class PropertiesLoginModule extends PropertiesLoader implements LoginModu principals.clear(); clear(); if (debug) { - ActiveMQServerLogger.LOGGER.debug("logout"); + logger.debug("logout"); } return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/ReloadableProperties.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/ReloadableProperties.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/ReloadableProperties.java index da4c651..77a99d9 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/ReloadableProperties.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/ReloadableProperties.java @@ -26,9 +26,12 @@ import java.util.Properties; import java.util.Set; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; +import org.jboss.logging.Logger; public class ReloadableProperties { + private static final Logger logger = Logger.getLogger(ReloadableProperties.class); + private Properties props = new Properties(); private Map invertedProps; private Map> invertedValueProps; @@ -51,13 +54,13 @@ public class ReloadableProperties { invertedProps = null; invertedValueProps = null; if (key.isDebug()) { - ActiveMQServerLogger.LOGGER.debug("Load of: " + key); + logger.debug("Load of: " + key); } } catch (IOException e) { ActiveMQServerLogger.LOGGER.error("Failed to load: " + key + ", reason:" + e.getLocalizedMessage()); if (key.isDebug()) { - ActiveMQServerLogger.LOGGER.debug("Load of: " + key + ", failure exception" + e); + logger.debug("Load of: " + key + ", failure exception" + e); } } reloadTime = System.currentTimeMillis(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f0df9d8c/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index c9824a0..92fdd72 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -130,6 +130,7 @@ import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule; import org.apache.activemq.artemis.utils.OrderedExecutorFactory; import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.UUIDGenerator; +import org.jboss.logging.Logger; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -145,6 +146,8 @@ import org.junit.runner.Description; */ public abstract class ActiveMQTestBase extends Assert { + private static final Logger logger = Logger.getLogger(ActiveMQTestBase.class); + @Rule public ThreadLeakCheckRule leakCheckRule = new ThreadLeakCheckRule(); @@ -1096,7 +1099,7 @@ public abstract class ActiveMQTestBase extends Assert { final int liveNodes, final int backupNodes, final long timeout) throws Exception { - ActiveMQServerLogger.LOGGER.debug("waiting for " + liveNodes + " on the topology for server = " + server); + logger.debug("waiting for " + liveNodes + " on the topology for server = " + server); long start = System.currentTimeMillis(); @@ -1147,7 +1150,7 @@ public abstract class ActiveMQTestBase extends Assert { String clusterConnectionName, final int nodes, final long timeout) throws Exception { - ActiveMQServerLogger.LOGGER.debug("waiting for " + nodes + " on the topology for server = " + server); + logger.debug("waiting for " + nodes + " on the topology for server = " + server); long start = System.currentTimeMillis();