for mkahadb populate mdc activemq.persistenceDir such that logging for a particular instance can be identified and correlated

This commit is contained in:
gtully 2016-07-04 11:19:44 +01:00
parent 73a8d7dd65
commit 4386750fdb
1 changed files with 3 additions and 0 deletions

View File

@ -112,6 +112,7 @@ import org.apache.activemq.util.ServiceSupport;
import org.apache.activemq.util.ThreadPoolUtils; import org.apache.activemq.util.ThreadPoolUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
public abstract class MessageDatabase extends ServiceSupport implements BrokerServiceAware { public abstract class MessageDatabase extends ServiceSupport implements BrokerServiceAware {
@ -1646,6 +1647,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
* @throws IOException * @throws IOException
*/ */
void checkpointUpdate(Transaction tx, boolean cleanup) throws IOException { void checkpointUpdate(Transaction tx, boolean cleanup) throws IOException {
MDC.put("activemq.persistenceDir", getDirectory().getName());
LOG.debug("Checkpoint started."); LOG.debug("Checkpoint started.");
// reflect last update exclusive of current checkpoint // reflect last update exclusive of current checkpoint
@ -1877,6 +1879,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
journalLogOnLastCompactionCheck = journal.getCurrentDataFileId(); journalLogOnLastCompactionCheck = journal.getCurrentDataFileId();
} }
} }
MDC.remove("activemq.persistenceDir");
LOG.debug("Checkpoint done."); LOG.debug("Checkpoint done.");
} }