Skip to content

Commit 8d21242

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** (cherry picked from commit 4fdb1e4)
1 parent 8124e9e commit 8d21242

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
@@ -916,6 +916,16 @@ private final class CachedChannelInvocationHandler implements InvocationHandler
916916

917917
@Override
918918
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
919+
if (logger.isTraceEnabled() && !method.getName().equals("toString")
920+
&& !method.getName().equals("hashCode") && !method.getName().equals("equals")) {
921+
try {
922+
logger.trace(this.target + " channel." + method.getName() + "("
923+
+ (args != null ? Arrays.toString(args) : "") + ")");
924+
}
925+
catch (Exception e) {
926+
// empty - some mocks fail here
927+
}
928+
}
919929
String methodName = method.getName();
920930
if (methodName.equals("txSelect") && !this.transactional) {
921931
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
@@ -933,7 +933,9 @@ public void handleCancelOk(String consumerTag) {
933933
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)
934934
throws IOException {
935935
if (logger.isDebugEnabled()) {
936-
logger.debug("Storing delivery for " + BlockingQueueConsumer.this);
936+
logger.debug("Storing delivery for consumerTag: '"
937+
+ consumerTag + "' with deliveryTag: '" + envelope.getDeliveryTag() + "' in "
938+
+ BlockingQueueConsumer.this);
937939
}
938940
try {
939941
if (BlockingQueueConsumer.this.abortStarted > 0) {

0 commit comments

Comments
 (0)