Commit ac30755b authored by Andre Freyssinet's avatar Andre Freyssinet

Adds correlation informations in logging to ease the message tracking.

parent b7c56d50
......@@ -145,8 +145,9 @@ public class AcquisitionModule implements ReliableTransmitter {
if (acquisitionHandler instanceof AcquisitionDaemon) {
isDaemon = true;
}
setProperties(properties);
// Creates and starts the AccquisitionModule.
setProperties(properties);
} catch (Exception exc) {
logger.log(BasicLevel.ERROR, "AcquisitionModule: can't create acquisition handler.", exc);
}
......@@ -402,6 +403,8 @@ public class AcquisitionModule implements ReliableTransmitter {
for (Iterator iterator = messages.iterator(); iterator.hasNext();) {
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.setDestination(destination.getId().toString(),
destination.hasName()?destination.getName():null,
......
......@@ -860,9 +860,12 @@ public class Queue extends Destination implements QueueMBean {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "Message " + msgId + " acknowledged.");
} else if ((logger.isLoggable(BasicLevel.WARN) || logmsg.isLoggable(BasicLevel.WARN))) {
logger.log(BasicLevel.WARN, "Message " + msgId + " not found for acknowledgement.");
logmsg.log(BasicLevel.WARN, getName() + ": message " + msgId + " not found for acknowledgement.");
} else {
if ((logger.isLoggable(BasicLevel.WARN) || logmsg.isLoggable(BasicLevel.WARN))) {
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 {
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 {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "Queue.addDeliveryTimeMessage(" + msg + ", " + clientCtx + ')');
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
if (nbMaxMsg > -1 && nbMaxMsg <= (messages.size() + deliveryTable.size() + getDelayedMessageCount())) {
......@@ -1560,7 +1576,7 @@ public class Queue extends Destination implements QueueMBean {
protected final void storeMessage(Message msg, boolean throwsExceptionOnFullDest) throws AccessException {
if (addMessage(msg, throwsExceptionOnFullDest)) {
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()) {
// Persisting the message.
......
Markdown is supported
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