Commit ac30755b authored by Andre Freyssinet's avatar Andre Freyssinet
Browse files

Adds correlation informations in logging to ease the message tracking.

parent b7c56d50
...@@ -145,8 +145,9 @@ public class AcquisitionModule implements ReliableTransmitter { ...@@ -145,8 +145,9 @@ public class AcquisitionModule implements ReliableTransmitter {
if (acquisitionHandler instanceof AcquisitionDaemon) { if (acquisitionHandler instanceof AcquisitionDaemon) {
isDaemon = true; isDaemon = true;
} }
setProperties(properties);
// Creates and starts the AccquisitionModule.
setProperties(properties);
} catch (Exception exc) { } catch (Exception exc) {
logger.log(BasicLevel.ERROR, "AcquisitionModule: can't create acquisition handler.", exc); logger.log(BasicLevel.ERROR, "AcquisitionModule: can't create acquisition handler.", exc);
} }
...@@ -402,6 +403,8 @@ public class AcquisitionModule implements ReliableTransmitter { ...@@ -402,6 +403,8 @@ public class AcquisitionModule implements ReliableTransmitter {
for (Iterator iterator = messages.iterator(); iterator.hasNext();) { for (Iterator iterator = messages.iterator(); iterator.hasNext();) {
Message message = (Message) iterator.next(); Message message = (Message) iterator.next();
if ((message.getProperty(message.CORRELATION_ID) == null) && (message.id != null))
message.setProperty(message.CORRELATION_ID, message.id);
message.id = "ID:" + destination.getDestinationId() + '_' + msgCount; message.id = "ID:" + destination.getDestinationId() + '_' + msgCount;
message.setDestination(destination.getId().toString(), message.setDestination(destination.getId().toString(),
destination.hasName()?destination.getName():null, destination.hasName()?destination.getName():null,
......
...@@ -860,9 +860,12 @@ public class Queue extends Destination implements QueueMBean { ...@@ -860,9 +860,12 @@ public class Queue extends Destination implements QueueMBean {
if (logger.isLoggable(BasicLevel.DEBUG)) if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "Message " + msgId + " acknowledged."); logger.log(BasicLevel.DEBUG, "Message " + msgId + " acknowledged.");
} else if ((logger.isLoggable(BasicLevel.WARN) || logmsg.isLoggable(BasicLevel.WARN))) { } else {
logger.log(BasicLevel.WARN, "Message " + msgId + " not found for acknowledgement."); if ((logger.isLoggable(BasicLevel.WARN) || logmsg.isLoggable(BasicLevel.WARN))) {
logmsg.log(BasicLevel.WARN, getName() + ": message " + msgId + " not found for acknowledgement."); String str = getName() + ": message " + msgId + " not found for acknowledgement.";
logger.log(BasicLevel.WARN, str);
logmsg.log(BasicLevel.WARN, str);
}
} }
} }
...@@ -1343,12 +1346,25 @@ public class Queue extends Destination implements QueueMBean { ...@@ -1343,12 +1346,25 @@ public class Queue extends Destination implements QueueMBean {
receiving = false; receiving = false;
} }
private static final String getIdString(Message msg) {
String jmsCorrelationId = msg.getCorrelationId();
Object joramCorrelationId = msg.getMsg().getProperty(msg.getMsg().CORRELATION_ID);
if ((jmsCorrelationId == null) && (joramCorrelationId == null))
return msg.getId();
if (jmsCorrelationId == null) jmsCorrelationId = "";
if (joramCorrelationId == null) joramCorrelationId = "";
return msg.getId() + " [" + jmsCorrelationId + '/' + joramCorrelationId + "]";
}
void addDeliveryTimeMessage(Message msg, int clientCtx, boolean throwsExceptionOnFullDest, boolean isHeader) throws AccessException { void addDeliveryTimeMessage(Message msg, int clientCtx, boolean throwsExceptionOnFullDest, boolean isHeader) throws AccessException {
if (logger.isLoggable(BasicLevel.DEBUG)) if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "Queue.addDeliveryTimeMessage(" + msg + ", " + clientCtx + ')'); logger.log(BasicLevel.DEBUG, "Queue.addDeliveryTimeMessage(" + msg + ", " + clientCtx + ')');
if (logmsg.isLoggable(BasicLevel.INFO)) if (logmsg.isLoggable(BasicLevel.INFO))
logmsg.log(BasicLevel.INFO, getName() + ": gets new delayed message " + msg.getId() + ", " + msg.order); logmsg.log(BasicLevel.INFO, getName() + ": gets new delayed message " + getIdString(msg) + ", " + msg.order);
// queue is full // queue is full
if (nbMaxMsg > -1 && nbMaxMsg <= (messages.size() + deliveryTable.size() + getDelayedMessageCount())) { if (nbMaxMsg > -1 && nbMaxMsg <= (messages.size() + deliveryTable.size() + getDelayedMessageCount())) {
...@@ -1560,7 +1576,7 @@ public class Queue extends Destination implements QueueMBean { ...@@ -1560,7 +1576,7 @@ public class Queue extends Destination implements QueueMBean {
protected final void storeMessage(Message msg, boolean throwsExceptionOnFullDest) throws AccessException { protected final void storeMessage(Message msg, boolean throwsExceptionOnFullDest) throws AccessException {
if (addMessage(msg, throwsExceptionOnFullDest)) { if (addMessage(msg, throwsExceptionOnFullDest)) {
if (logmsg.isLoggable(BasicLevel.INFO)) if (logmsg.isLoggable(BasicLevel.INFO))
logmsg.log(BasicLevel.INFO, getName() + ": adds new message " + msg.getId() + ", " + msg.order); logmsg.log(BasicLevel.INFO, getName() + ": adds new message " + getIdString(msg) + ", " + msg.order);
if (msg.isPersistent()) { if (msg.isPersistent()) {
// Persisting the message. // Persisting the message.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment