IBM MQ - How to log the time when each message is received and sent along with a timestamp for each
search cancel

IBM MQ - How to log the time when each message is received and sent along with a timestamp for each

book

Article ID: 48419

calendar_today

Updated On:

Products

Service Virtualization

Issue/Introduction

Would to log the time when each message is received and sent along with a timestamp for each. Want to track each message through the model and match them to the app send and receive times. Somewhere along the path from the app through the MQ's and in the vs model there's a 3-second delay could not be found.

 

Environment

All supported DevTest releases.

Resolution

The preferred approach is to use the logging that is provided in the messageId at debug level.

How to Implement Preferred Approach:

Step 1 : Create appender for MQ ( Lets name it as MQAPPENDER) Add this to existing appenders list in logging.properties

appenders = A1, ACL_LOG, VSEAPP, ADVICE_APP, THREAD_DUMPS, STDOUT, MQAPPENDER

Configure policies for MQAPPENDER 

appender.MQAPPENDER.type = RollingFile
appender.MQAPPENDER.name = MQAPPENDER
appender.MQAPPENDER.fileName = ${LISA_HOME}/tmp/mq_messaging.log
appender.MQAPPENDER.filePattern = ${sys:lisa.tmpdir}/mq_messaging.log.%i
appender.MQAPPENDER.layout.type = PatternLayout
appender.MQAPPENDER.layout.pattern = %d{ISO8601}{UTC}Z (%d{HH:mm}) [%t] %-5p %-30c - %m%n
appender.MQAPPENDER.policies.type = Policies
appender.MQAPPENDER.policies.size.type = SizeBasedTriggeringPolicy
appender.MQAPPENDER.policies.size.size = 10MB
appender.MQAPPENDER.strategy.type = DefaultRolloverStrategy
appender.MQAPPENDER.strategy.max = 20
appender.MQAPPENDER.strategy.fileIndex = min

Add this to your logging.properties in DevTest 10.7.2 and later

Step 2: Create logger for MQ ( lets name it as mqlogger) Add this to existing loggers list in logging.properties 

loggers = teamdev, eventlogger, apache, smardec, apachehttp, mchange, hibernate, ….., mqlogger

Configure logger as below  
logger.mqlogger.name = com.itko.lisa.jms.mq.MQJavaEngine
logger.mqlogger.level = DEBUG
logger.mqlogger.additivity = false
logger.mqlogger.appenderRefs= MQAPPENDER
logger.mqlogger.appenderRef.MQAPPENDER.ref = MQAPPENDER

 

That will redirect all the MQ-related logging to its own file, which will simplify things.