Skip to content

Commit 4fdb1e4

Browse files
garyrussellartembilan
authored andcommitted
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**
1 parent f3b977d commit 4fdb1e4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactory.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,16 @@ private final class CachedChannelInvocationHandler implements InvocationHandler
947947

948948
@Override
949949
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
950+
if (logger.isTraceEnabled() && !method.getName().equals("toString")
951+
&& !method.getName().equals("hashCode") && !method.getName().equals("equals")) {
952+
try {
953+
logger.trace(this.target + " channel." + method.getName() + "("
954+
+ (args != null ? Arrays.toString(args) : "") + ")");
955+
}
956+
catch (Exception e) {
957+
// empty - some mocks fail here
958+
}
959+
}
950960
String methodName = method.getName();
951961
if (methodName.equals("txSelect") && !this.transactional) {
952962
throw new UnsupportedOperationException("Cannot start transaction on non-transactional channel");

spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/BlockingQueueConsumer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,9 @@ public void handleCancelOk(String consumerTag) {
920920
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)
921921
throws IOException {
922922
if (logger.isDebugEnabled()) {
923-
logger.debug("Storing delivery for " + BlockingQueueConsumer.this);
923+
logger.debug("Storing delivery for consumerTag: '"
924+
+ consumerTag + "' with deliveryTag: '" + envelope.getDeliveryTag() + "' in "
925+
+ BlockingQueueConsumer.this);
924926
}
925927
try {
926928
if (BlockingQueueConsumer.this.abortStarted > 0) {

0 commit comments

Comments
 (0)