(For the purpose of this example, we'll use '9e9fa021-37a6-46e7-b42a-b035b1736ca8' for my provider ID. Your provider GUIID will be different)

Starting a trace session

To start a trace session
logman start trace "Test" -p "{9e9fa021-37a6-46e7-b42a-b035b1736ca8}" 255 7 -o test.etl -ets
<run your app>
logman stop "Test" -ets

This will result in the trace spew being written to a binary file named "test.etl." In general, this is what you'd have a customer zip up and send you; it's going to be reasonably compact, as it's just the raw data and does not contain any formatting.

Formatting the trace output

Once you generate/obtain the file from the above steps, you need to get it formatted for human consumption. To do this, we can use TraceView (as mentioned in the NTrace site) or you can use the tracefmt tool:

tracefmt test.etl -p <Path to your app's TMF files, e.g.: C:\MyProject\bin\Debug\Trace>

The tracefmt tool emits a pair of files: FmtFile.txt (human-readable format) and FmtSum.txt (a summary of the formatting pass).

For completeness' sake, here's how you'd do it with tracelog.exe:
tracelog -start Test -guid #9e9fa021-37a6-46e7-b42a-b035b1736ca8 -flag 255 -level 7 -f test.etl
<run your app>
tracelog -stop Test
tracefmt test.etl -p <Path to your app's TMF files, e.g.: C:\MyProject\bin\Debug\Trace>

Generating traces in real-time ("live" trace output)

If you want to do real-time tracing (akin to running DbgView to see the trace spew in real-time), use the following:
logman start trace Test -p {9e9fa021-37a6-46e7-b42a-b035b1736ca8} 255 7 -rt -ets
(or tracelog -start Test -guid #9e9fa021-37a6-46e7-b42a-b035b1736ca8 -flag 255 -level 7 -rt)
tracefmt -rt Test -p <Path to your app's TMF files, e.g.: C:\MyProject\bin\Debug\Trace> -display

The tracefmt tool is delivered with the newer versions of the Windows SDK. TraceView and tracelog are available as part of the Windows Device Driver Kit.

Last edited Sep 8, 2011 at 12:35 PM by ahopper, version 3

Comments

No comments yet.