Share via


Trace Context

A trace context is a tag that you can apply to traces to organize them into groups or trees. A context consists of two components: a current context and a parent context. When both values are specified, an XSLT can construct a context tree that groups traces according to their contexts.

You can use context to tag messages that span across multiple computers, processes, or threads. This operation becomes particularly useful when you want to perform client-server testing.

Your application can call the SetContext function or method to switch from one context to another. However, you must take care when choosing the context to which you switch, because DTM Logger cannot prevent you from switching to an invalid context.

To switch contexts by using C

Call the WTTLogSetContext function, and pass it the current context and the parent context.

To switch contexts by using C++

Call the CWTTLogger::SetContext method, and pass it the current context and the parent context.

To switch contexts by using COM

Call the IWTTLog::SetContext method, and pass it the current context and the parent context.

To switch contexts by using .NET

Call the WTTLogger.SetContext method.

Context XML element

A typical context element in an XML log file looks like the following example.

    <CTX ID="139721409" Current="Test1" Parent="WTTLOG" /> 

For more information about the context element, see Logger XML Schema.

See Also

Performing a Trace, Trace Level, Trace Priority

Send feedback on this topic
Built on December 10, 2009