Add more debug/trace logging

- add delivery tag to inbound delivery logs
- add trace logging to channel method calls

**cherry-pick to 2.0.x, 1.7.x**
This commit is contained in:
Gary Russell
2018-06-05 17:21:29 -04:00
committed by Artem Bilan
parent f3b977dbb9
commit 4fdb1e4ddf
2 changed files with 13 additions and 1 deletions

View File

@@ -947,6 +947,16 @@ public class CachingConnectionFactory extends AbstractConnectionFactory
@Override @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (logger.isTraceEnabled() && !method.getName().equals("toString")
&& !method.getName().equals("hashCode") && !method.getName().equals("equals")) {
try {
logger.trace(this.target + " channel." + method.getName() + "("
+ (args != null ? Arrays.toString(args) : "") + ")");
}
catch (Exception e) {
// empty - some mocks fail here
}
}
String methodName = method.getName(); String methodName = method.getName();
if (methodName.equals("txSelect") && !this.transactional) { if (methodName.equals("txSelect") && !this.transactional) {
throw new UnsupportedOperationException("Cannot start transaction on non-transactional channel"); throw new UnsupportedOperationException("Cannot start transaction on non-transactional channel");

View File

@@ -920,7 +920,9 @@ public class BlockingQueueConsumer implements RecoveryListener {
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)
throws IOException { throws IOException {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Storing delivery for " + BlockingQueueConsumer.this); logger.debug("Storing delivery for consumerTag: '"
+ consumerTag + "' with deliveryTag: '" + envelope.getDeliveryTag() + "' in "
+ BlockingQueueConsumer.this);
} }
try { try {
if (BlockingQueueConsumer.this.abortStarted > 0) { if (BlockingQueueConsumer.this.abortStarted > 0) {