Merge pull request #466 from coheigea/misc_fixes

AMQ-7413 - Misc logging fixes
This commit is contained in:
Jean-Baptiste Onofré 2020-02-22 07:49:55 +01:00 committed by GitHub
commit bfb810c507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 69 additions and 66 deletions

View File

@ -228,7 +228,7 @@ public class AmqpConnection extends AmqpAbstractResource<Connection> implements
request.sync(closeTimeout, TimeUnit.MILLISECONDS); request.sync(closeTimeout, TimeUnit.MILLISECONDS);
} }
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Error caught while closing Provider: ", e.getMessage()); LOG.warn("Error caught while closing Provider: {}", e.getMessage());
} finally { } finally {
if (transport != null) { if (transport != null) {
try { try {

View File

@ -2163,7 +2163,7 @@ public class BrokerService implements Service {
/** /**
* Schedules a periodic task based on schedulePeriodForDiskLimitCheck to * Schedules a periodic task based on schedulePeriodForDiskLimitCheck to
* update store and temporary store limits if the amount of available space * update store and temporary store limits if the amount of available space
* plus current store size is less than the existin configured limit * plus current store size is less than the existing configured limit
*/ */
protected void scheduleDiskUsageLimitsCheck() throws IOException { protected void scheduleDiskUsageLimitsCheck() throws IOException {
if (schedulePeriodForDiskUsageCheck > 0 && if (schedulePeriodForDiskUsageCheck > 0 &&

View File

@ -21,7 +21,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class NetworkDestinationView implements NetworkDestinationViewMBean { public class NetworkDestinationView implements NetworkDestinationViewMBean {
private static final Logger LOG = LoggerFactory.getLogger(NetworkDestinationViewMBean.class); private static final Logger LOG = LoggerFactory.getLogger(NetworkDestinationView.class);
private TimeStatisticImpl timeStatistic = new TimeStatisticImpl("networkEnqueue","network messages enqueued"); private TimeStatisticImpl timeStatistic = new TimeStatisticImpl("networkEnqueue","network messages enqueued");
private final String name; private final String name;

View File

@ -894,10 +894,10 @@ public class Topic extends BaseDestination implements Task {
try { try {
durableTopicSubscription.dispatchPending(); durableTopicSubscription.dispatchPending();
} catch (IOException exception) { } catch (IOException exception) {
LOG.warn("After clear of pending, failed to dispatch to: {}, for: {}, pending: {}", new Object[]{ LOG.warn("After clear of pending, failed to dispatch to: {}, for: {}, pending: {}, exception: {}", new Object[]{
durableTopicSubscription, durableTopicSubscription,
destination, destination,
durableTopicSubscription.pending }, exception); durableTopicSubscription.pending, exception });
} }
} }
} }

View File

@ -199,7 +199,7 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
if (prioritizedMessages && immediatePriorityDispatch && tsp.isPaging()) { if (prioritizedMessages && immediatePriorityDispatch && tsp.isPaging()) {
if (msg.getPriority() > tsp.getLastRecoveredPriority()) { if (msg.getPriority() > tsp.getLastRecoveredPriority()) {
tsp.recoverMessage(node.getMessage(), true); tsp.recoverMessage(node.getMessage(), true);
LOG.trace("cached high priority ({} message: {}, current paged batch priority: {}, cache size: {}", new Object[]{ msg.getPriority(), msg.getMessageId(), tsp.getLastRecoveredPriority(), tsp.batchList.size()}); LOG.trace("cached high priority ({}) message: {}, current paged batch priority: {}, cache size: {}", new Object[]{ msg.getPriority(), msg.getMessageId(), tsp.getLastRecoveredPriority(), tsp.batchList.size()});
} }
} }
} }

View File

@ -28,7 +28,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* persist pendingCount messages pendingCount message (messages awaiting disptach * persist pendingCount messages pendingCount message (messages awaiting dispatch
* to a consumer) cursor * to a consumer) cursor
* *
* *

View File

@ -163,7 +163,7 @@ public class AbortSlowAckConsumerStrategy extends AbortSlowConsumerStrategy {
if (getMaxSlowDuration() > 0 && (entry.getValue().markCount * getCheckPeriod() >= getMaxSlowDuration()) || if (getMaxSlowDuration() > 0 && (entry.getValue().markCount * getCheckPeriod() >= getMaxSlowDuration()) ||
getMaxSlowCount() > 0 && entry.getValue().slowCount >= getMaxSlowCount()) { getMaxSlowCount() > 0 && entry.getValue().slowCount >= getMaxSlowCount()) {
LOG.trace("Transferring consumer{} to the abort list: {} slow duration = {}, slow count = {}", LOG.trace("Transferring consumer {} to the abort list: {} slow duration = {}, slow count = {}",
new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(),
entry.getValue().markCount * getCheckPeriod(), entry.getValue().markCount * getCheckPeriod(),
entry.getValue().getSlowCount() }); entry.getValue().getSlowCount() });

View File

@ -1140,7 +1140,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
} }
} catch (Exception e) { } catch (Exception e) {
LOG.warn("failed to fire forward failure advisory, cause: {}", e); LOG.warn("failed to fire forward failure advisory, cause: {}", (Object)e);
LOG.debug("detail", e); LOG.debug("detail", e);
} }
} }

View File

@ -149,7 +149,7 @@ public abstract class DestinationBridge implements Service, MessageListener {
return; return;
} catch (Exception e) { } catch (Exception e) {
LOG.info("failed to forward message on attempt: {} reason: {} message: {}", new Object[]{ attempt, e, message }, e); LOG.info("failed to forward message on attempt: {} reason: {} message: {}", new Object[]{ attempt, e, message });
} }
} }
} }

View File

@ -162,7 +162,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
TextMessage message = session.createTextMessage("Batch Message"); TextMessage message = session.createTextMessage("Batch Message");
for (int j = 0; j < batchCount; j++) { for (int j = 0; j < batchCount; j++) {
LOG.info("Producing bacth " + j + " of " + batchSize + " messages"); LOG.info("Producing batch " + j + " of " + batchSize + " messages");
beginTx(); beginTx();
for (int i = 0; i < batchSize; i++) { for (int i = 0; i < batchSize; i++) {
@ -170,7 +170,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
} }
messageSent(); messageSent();
commitTx(); commitTx();
LOG.info("Consuming bacth " + j + " of " + batchSize + " messages"); LOG.info("Consuming batch " + j + " of " + batchSize + " messages");
beginTx(); beginTx();
for (int i = 0; i < batchSize; i++) { for (int i = 0; i < batchSize; i++) {
@ -187,7 +187,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
} }
/** /**
* Sends a batch of messages and validates that the rollbacked message was * Sends a batch of messages and validates that the rolled-back message was
* not consumed. * not consumed.
* *
* @throws Exception * @throws Exception
@ -200,7 +200,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
producer.send(outbound[0]); producer.send(outbound[0]);
commitTx(); commitTx();
// sends a message that gets rollbacked // sends a message that gets rolled-back
beginTx(); beginTx();
producer.send(session.createTextMessage("I'm going to get rolled back.")); producer.send(session.createTextMessage("I'm going to get rolled back."));
rollbackTx(); rollbackTx();
@ -224,7 +224,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
messages.add(message); messages.add(message);
LOG.info("Received: " + message); LOG.info("Received: " + message);
// validates that the rollbacked was not consumed // validates that the rolled-back was not consumed
commitTx(); commitTx();
Message inbound[] = new Message[messages.size()]; Message inbound[] = new Message[messages.size()];
messages.toArray(inbound); messages.toArray(inbound);
@ -253,7 +253,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
messages.add(message); messages.add(message);
LOG.info("Received: " + message); LOG.info("Received: " + message);
// validates that the rollbacked was not consumed // validates that the rolled-back was not consumed
commitTx(); commitTx();
Message inbound[] = new Message[messages.size()]; Message inbound[] = new Message[messages.size()];
messages.toArray(inbound); messages.toArray(inbound);
@ -275,7 +275,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
producer.send(outbound[0]); producer.send(outbound[0]);
commitTx(); commitTx();
// sends a message that gets rollbacked // sends a message that gets rolled-back
beginTx(); beginTx();
producer.send(session.createTextMessage("I'm going to get rolled back.")); producer.send(session.createTextMessage("I'm going to get rolled back."));
consumer.close(); consumer.close();
@ -300,7 +300,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
messages.add(message); messages.add(message);
LOG.info("Received: " + message); LOG.info("Received: " + message);
// validates that the rollbacked was not consumed // validates that the rolled-back was not consumed
commitTx(); commitTx();
Message inbound[] = new Message[messages.size()]; Message inbound[] = new Message[messages.size()];
messages.toArray(inbound); messages.toArray(inbound);
@ -321,7 +321,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
producer.send(outbound[0]); producer.send(outbound[0]);
commitTx(); commitTx();
// sends a message that gets rollbacked // sends a message that gets rolled-back
beginTx(); beginTx();
producer.send(session.createTextMessage("I'm going to get rolled back.")); producer.send(session.createTextMessage("I'm going to get rolled back."));
consumer.close(); consumer.close();
@ -348,7 +348,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
messages.add(message); messages.add(message);
LOG.info("Received: " + message); LOG.info("Received: " + message);
// validates that the rollbacked was not consumed // validates that the rolled-back was not consumed
commitTx(); commitTx();
Message inbound[] = new Message[messages.size()]; Message inbound[] = new Message[messages.size()];
messages.toArray(inbound); messages.toArray(inbound);
@ -356,7 +356,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
} }
/** /**
* Sends a batch of messages and validates that the rollbacked message was * Sends a batch of messages and validates that the rolled-back message was
* redelivered. * redelivered.
* *
* @throws Exception * @throws Exception
@ -407,7 +407,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
} }
/** /**
* Sends a batch of messages and validates that the rollbacked message was * Sends a batch of messages and validates that the rolled-back message was
* redelivered. * redelivered.
* *
* @throws Exception * @throws Exception
@ -461,7 +461,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
} }
/** /**
* Sends a batch of messages and validates that the rollbacked message was * Sends a batch of messages and validates that the rolled-back message was
* not consumed. * not consumed.
* *
* @throws Exception * @throws Exception
@ -487,12 +487,12 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
LOG.info("Received: " + message); LOG.info("Received: " + message);
} }
// validates that the rollbacked was not consumed // validates that the rolled-back was not consumed
commitTx(); commitTx();
} }
/** /**
* Perform the test that validates if the rollbacked message was redelivered * Perform the test that validates if the rolled-back message was redelivered
* multiple times. * multiple times.
* *
* @throws Exception * @throws Exception
@ -504,7 +504,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
} }
/** /**
* Sends a batch of messages and validates that the rollbacked message was * Sends a batch of messages and validates that the rolled-back message was
* not consumed. This test differs by setting the message prefetch to one. * not consumed. This test differs by setting the message prefetch to one.
* *
* @throws Exception * @throws Exception
@ -515,7 +515,7 @@ public abstract class JmsTransactionTestSupport extends TestSupport implements M
} }
/** /**
* Sends a batch of messages and and validates that the rollbacked message * Sends a batch of messages and and validates that the rolled-back message
* was redelivered. This test differs by setting the message prefetch to * was redelivered. This test differs by setting the message prefetch to
* one. * one.
* *

View File

@ -819,7 +819,7 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
try { try {
session.sendAck(ackToSend,true); session.sendAck(ackToSend,true);
} catch (JMSException e) { } catch (JMSException e) {
LOG.error(getConsumerId() + " failed to delivered acknowledgements", e); LOG.error(getConsumerId() + " failed to deliver acknowledgements", e);
} finally { } finally {
deliveryingAcknowledgements.set(false); deliveryingAcknowledgements.set(false);
} }

View File

@ -40,7 +40,7 @@ public class JNDIReferenceFactory implements ObjectFactory {
/** /**
* This will be called by a JNDIprovider when a Reference is retrieved from * This will be called by a JNDIprovider when a Reference is retrieved from
* a JNDI store - and generates the orignal instance * a JNDI store - and generates the original instance
* *
* @param object the Reference object * @param object the Reference object
* @param name the JNDI name * @param name the JNDI name

View File

@ -259,7 +259,7 @@ public abstract class AbstractInactivityMonitor extends TransportFilter {
} }
} else { } else {
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("Message received since last read check, resetting flag: "); LOG.trace("Message received since last read check, resetting flag: {}", this);
} }
} }
commandReceived.set(false); commandReceived.set(false);

View File

@ -291,26 +291,29 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable {
discoveryURI = new URI(DEFAULT_DISCOVERY_URI_STRING); discoveryURI = new URI(DEFAULT_DISCOVERY_URI_STRING);
} }
if (LOG.isTraceEnabled()) if (LOG.isTraceEnabled()) {
LOG.trace("start - discoveryURI = " + discoveryURI); LOG.trace("start - discoveryURI = " + discoveryURI);
}
String myHost = discoveryURI.getHost(); String myHost = discoveryURI.getHost();
int myPort = discoveryURI.getPort(); int myPort = discoveryURI.getPort();
if( DEFAULT_HOST_STR.equals(myHost) ) if (DEFAULT_HOST_STR.equals(myHost)) {
myHost = DEFAULT_HOST_IP; myHost = DEFAULT_HOST_IP;
}
if(myPort < 0 ) if (myPort < 0) {
myPort = DEFAULT_PORT; myPort = DEFAULT_PORT;
}
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("start - myHost = " + myHost); LOG.trace("start - myHost = " + myHost);
LOG.trace("start - myPort = " + myPort); LOG.trace("start - myPort = " + myPort);
LOG.trace("start - group = " + group ); LOG.trace("start - group = " + group);
LOG.trace("start - interface = " + mcInterface ); LOG.trace("start - interface = " + mcInterface);
LOG.trace("start - network interface = " + mcNetworkInterface ); LOG.trace("start - network interface = " + mcNetworkInterface);
LOG.trace("start - join network interface = " + mcJoinNetworkInterface ); LOG.trace("start - join network interface = " + mcJoinNetworkInterface);
} }
this.inetAddress = InetAddress.getByName(myHost); this.inetAddress = InetAddress.getByName(myHost);
this.sockAddress = new InetSocketAddress(this.inetAddress, myPort); this.sockAddress = new InetSocketAddress(this.inetAddress, myPort);

View File

@ -184,7 +184,7 @@ public class IdGenerator {
/** /**
* From a generated id - return the seed (i.e. minus the count) * From a generated id - return the seed (i.e. minus the count)
* *
* @param id the generated identifer * @param id the generated identifier
* @return the seed * @return the seed
*/ */
public static String getSeedFromId(String id) { public static String getSeedFromId(String id) {

View File

@ -191,7 +191,7 @@ public class MQTTWSConnection extends WebSocketAdapter implements WebSocketListe
try { try {
frame = (MQTTFrame)wireFormat.unmarshal(new ByteSequence(data, offset, length)); frame = (MQTTFrame)wireFormat.unmarshal(new ByteSequence(data, offset, length));
} catch (IOException e) { } catch (IOException e) {
LOG.error("Could not decode incoming MQTT Frame: ", e.getMessage()); LOG.error("Could not decode incoming MQTT Frame: {}", e.getMessage());
connection.close(); connection.close();
} }
@ -245,7 +245,7 @@ public class MQTTWSConnection extends WebSocketAdapter implements WebSocketListe
connection.close(); connection.close();
} }
} catch (Exception e) { } catch (Exception e) {
LOG.error("Could not decode incoming MQTT Frame: ", e.getMessage()); LOG.error("Could not decode incoming MQTT Frame: {}", e.getMessage());
connection.close(); connection.close();
} }
} }

View File

@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory;
public class PropertiesLoader { public class PropertiesLoader {
private static final Logger LOG = LoggerFactory.getLogger(PropertiesLoader.class); private static final Logger LOG = LoggerFactory.getLogger(PropertiesLoader.class);
static Map<FileNameKey, ReloadableProperties> staticCache = new HashMap<FileNameKey, ReloadableProperties>(); static final Map<FileNameKey, ReloadableProperties> staticCache = new HashMap<FileNameKey, ReloadableProperties>();
protected boolean debug; protected boolean debug;
public void init(Map options) { public void init(Map options) {

View File

@ -256,7 +256,7 @@ public class PooledConnection implements TopicConnection, QueueConnection, Poole
try { try {
session.close(); session.close();
} catch (JMSException ex) { } catch (JMSException ex) {
LOG.info("failed to close laoned Session \"" + session + "\" on closing pooled connection: " + ex.getMessage()); LOG.info("failed to close loaned Session \"" + session + "\" on closing pooled connection: " + ex.getMessage());
} }
} }
loanedSessions.clear(); loanedSessions.clear();

View File

@ -43,7 +43,7 @@ public class JmsPoolTestSupport {
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
LOG.info("========== start " + getTestName() + " =========="); LOG.info("========== start {} ==========", getTestName());
} }
@After @After
@ -54,11 +54,11 @@ public class JmsPoolTestSupport {
brokerService.waitUntilStopped(); brokerService.waitUntilStopped();
brokerService = null; brokerService = null;
} catch (Exception ex) { } catch (Exception ex) {
LOG.warn("Suppress error on shutdown: {}", ex); LOG.warn("Suppress error on shutdown: {}", (Object)ex);
} }
} }
LOG.info("========== tearDown " + getTestName() + " =========="); LOG.info("========== tearDown {} ==========", getTestName());
} }
public String getTestName() { public String getTestName() {

View File

@ -198,11 +198,11 @@ public class MultiKahaDBPersistenceAdapter extends LockableServiceSupport implem
if (filteredAdapter.getDestination() == matchAll && filteredAdapter.isPerDestination()) { if (filteredAdapter.getDestination() == matchAll && filteredAdapter.isPerDestination()) {
filteredAdapter = addAdapter(filteredAdapter, destination); filteredAdapter = addAdapter(filteredAdapter, destination);
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.info("created per destination adapter for: " + destination + ", " + result); LOG.trace("created per destination adapter for: " + destination + ", " + result);
} }
} }
startAdapter(filteredAdapter.getPersistenceAdapter(), destination.getQualifiedName()); startAdapter(filteredAdapter.getPersistenceAdapter(), destination.getQualifiedName());
LOG.debug("destination {} matched persistence adapter {}", new Object[]{destination.getQualifiedName(), filteredAdapter.getPersistenceAdapter()}); LOG.debug("destination {} matched persistence adapter {}", destination.getQualifiedName(), filteredAdapter.getPersistenceAdapter());
return filteredAdapter.getPersistenceAdapter(); return filteredAdapter.getPersistenceAdapter();
} }
@ -330,11 +330,11 @@ public class MultiKahaDBPersistenceAdapter extends LockableServiceSupport implem
if (adapterDir != null) { if (adapterDir != null) {
if (IOHelper.deleteFile(adapterDir)) { if (IOHelper.deleteFile(adapterDir)) {
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.info("deleted per destination adapter directory for: " + destination); LOG.trace("deleted per destination adapter directory for: " + destination);
} }
} else { } else {
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.info("failed to deleted per destination adapter directory for: " + destination); LOG.trace("failed to deleted per destination adapter directory for: " + destination);
} }
} }
} }

View File

@ -753,7 +753,7 @@ public class MQTTProtocolConverter {
if (response.isException()) { if (response.isException()) {
Throwable error = ((ExceptionResponse) response).getException(); Throwable error = ((ExceptionResponse) response).getException();
LOG.warn("Failed to send MQTT Publish: {}: {}", command, error.getMessage()); LOG.warn("Failed to send MQTT Publish: {}: {}", command, error.getMessage());
LOG.trace("Error trace: {}", error); LOG.trace("Error trace: {}", (Object)error);
} }
switch (command.qos()) { switch (command.qos()) {

View File

@ -355,4 +355,4 @@ public class ActiveMQResourceAdapter extends ActiveMQConnectionSupport implement
} }
} }

View File

@ -132,7 +132,7 @@ public class LocalAndXATransaction implements XAResource, LocalTransaction {
public Xid[] recover(int arg0) throws XAException { public Xid[] recover(int arg0) throws XAException {
Xid[] answer = null; Xid[] answer = null;
LOG.trace("{} recover({})", new Object[]{this, arg0}); LOG.trace("{} recover({})", this, arg0);
answer = transactionContext.recover(arg0); answer = transactionContext.recover(arg0);
LOG.trace("{} recover({}) = {}", new Object[]{this, arg0, answer}); LOG.trace("{} recover({}) = {}", new Object[]{this, arg0, answer});
return answer; return answer;