Skip to content

Commit 54b7dd8

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 3a55ede commit 54b7dd8

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

912912
@Override
913913
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
914+
if (logger.isTraceEnabled() && !method.getName().equals("toString")
915+
&& !method.getName().equals("hashCode") && !method.getName().equals("equals")) {
916+
try {
917+
logger.trace(this.target + " channel." + method.getName() + "("
918+
+ (args != null ? Arrays.toString(args) : "") + ")");
919+
}
920+
catch (Exception e) {
921+
// empty - some mocks fail here
922+
}
923+
}
914924
String methodName = method.getName();
915925
if (methodName.equals("txSelect") && !this.transactional) {
916926
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)