Question & Answer
Question
How do I generate an IBM MQ trace on Windows systems in order to investigate a problem?
Cause
Traces can capture the root cause of many MQ problems. It is important to limit how long tracing is active in order to avoid affecting performance or generating excessively large trace files and filling up your disk. For other MQ traces refer to:
Make sure the IBM MQ trace directory is on a disk with plenty of available space. Otherwise, you risk an outage if MQ trace fills the disk which your queue managers are using. The disk containing the trace directory must have sufficient free space since a partial trace may not contain the information IBM Support needs to solve the problem.
IBM MQ traces may show some or all of the contents of messages flowing through the system. IBM treats customer documentation as confidential, sharing it among support personnel on a need to know basis. Use the '-d 0' option if you need to prevent MQ from including any message data in its traces.
Answer
Multiple Installations
IBM MQ V8.0 and WebSphere MQ V7.1 and later support multiple installations on a single Linux or UNIX system, which can coexist with a previous installation of WebSphere MQ V7.0.1.6 or later. Each installation has its own independent trace commands, so you must be careful to trace the right installation.
For example, if you are tracing a queue manager or application associated with Installation1, then you must use the setmqenv command to switch to Installation1 before running any of the commands to start, stop, or format traces. Otherwise, your trace will capture no useful information.
You can even trace two or more installations simultaneously. Be sure to stop tracing in all installations to avoid filling up your disk or affecting system performance.
Generating Traces
- If your system has IBM MQ V8.0 or WebSphere MQ V7.1 or later, source the setmqenv command to set your environment for the installation you want to trace. It doesn't matter which copy of setmqenv you use, but the arguments to setmqenv are important. For example:
- Start tracing with the strmqtrc command. For all releases except WebSphere MQ V6.0, the parameters passed to strmqtrc control which processes will generate trace files and what kinds of data they will trace. You can run multiple traces with different parameters at the same time, if necessary. For example:
- Reproduce the problem while tracing is active, making every attempt to keep the trace as short as possible. On Windows systems there is a process called amqztrcn which runs when tracing is active, but IBM MQ V8.0 WebSphere MQ V7.0 and later also provides the following command to check the trace status:
- As soon as the problem has occurred, stop tracing immediately! If you wait to stop the trace, the data IBM Support needs may be lost or overwritten. For all releases except WebSphere MQ V6.0, you can stop all traces at once, or you can stop each trace individually:
- The trace files generated by IBM MQ on Windows are readable text files (except AMQ.SSL.TRC and AMQ.SSL.TRC.1, if present) and do not need to be formatted. If you are running WebSphere MQ V7.0 or earlier, the traces are written to the "trace" subdirectory wherever WebSphere MQ is installed. For IBM MQ V8.0 and WebSphere MQ V7.1 or later, the traces are written to the "trace" subdirectory under the path given by the MQ_DATA_PATH environment variable. For systems with IBM MQ V8.0 only, this directory may be located under C:\ProgramData, which is a hidden by default on Windows. After running setmqenv, you can find the location of the trace directory by running:
- IBM MQ V8.0, WebSphere MQ V7.5 or later, V7.1.0.1 or later, and V7.0.1.8 or later provide the runmqras command to collect your IBM MQ traces and other data by specifying the "trace" section name. If the traces are very large, you may need to use the "-workdirectory" option to package the files in a directory with plenty of free space. If you are running an older version of WebSphere MQ, zip up the traces manually before sending them to IBM. For example, to collect data about queue manager QMA for your IBM Problem Management Record 12345,67R,890 run:
- Save a copy of the trace files as long as you are working with IBM support, but keep them somewhere other than the trace directory. Clean up the trace directory to reclaim space and also to make sure you are ready to generate new traces in future, if necessary. For example:
Setting your environment for the installation with queue manager QMA
C:\> "C:\Program Files\IBM\MQ\bin\setmqenv" -m QMA
Setting your environment installation Installation2
C:\> "C:\Program Files (x86)\IBM\WebSphere MQ_1\bin\setmqenv" -n Installation2
Starting a default detail trace of queue manager QMA
C:\> strmqtrc -m QMA
Starting a default detail trace of queue manager QMB with no message data included
C:\> strmqtrc -m QMB -d 0
Starting an API trace of processes named amqsput with all message data included
C:\> strmqtrc -t api -p amqsput -d all
Starting a high detail trace of everything with files that wrap at 100MB
C:\> strmqtrc -e -t all -t detail -l 100
If you are running WebSphere MQ V6.0, trace always includes all processes. However, you can control what data each process will trace and whether the trace files will wrap:
Starting a V6.0 default detail trace
C:\> strmqtrc
Starting a V6.0 high detail trace with no message data and files that wrap at 100MB
C:\> strmqtrc -t all -t detail -d 0 -l 100
Checking the trace status
C:\> strmqtrc -s
Stopping all traces in an installation
C:\> endmqtrc -a
Stopping a trace of queue manager QMA
C:\> endmqtrc -m QMA
Stopping a trace of processes named amqsput
C:\> endmqtrc -p amqsput
If you are running WebSphere MQ V6.0, the command takes no parameters and stops all tracing:
Stopping all V6.0 trace
C:\> endmqtrc
Finding the trace directory in IBM MQ V8.0 and WebSphere MQ V7.1 and later
C:\> echo "%MQ_DATA_PATH%\trace"
Using runmqras to collect IBM MQ traces and other data
C:\> runmqras -section trace,defs,cluster -pmrno 12345,67R,890 -qmlist QMA -workdirectory D:\TEMP
Cleaning up the trace directory
C:\> CD "%MQ_DATA_PATH%\trace"
C:\ProgramData\IBM\MQ\trace> DEL AMQ*.TRC AMQ*.TRS
Additional Information
WebSphere MQ V7.0
[{"Product":{"code":"SSFKSJ","label":"WebSphere MQ"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Problem Determination","Platform":[{"code":"PF033","label":"Windows"}],"Version":"9.0;8.0;7.5;7.1;7.0;6.0","Edition":"All Editions","Line of Business":{"code":"LOB45","label":"Automation"}}]
Product Synonym
WebSphere MQ WMQ
WebSphere MQ V7.0
Product Synonym
WebSphere MQ WMQ
Was this topic helpful?
Document Information
Modified date:
22 June 2018
UID
swg21666876