CorrelationManager Class

 

Correlates traces that are part of a logical transaction.

Namespace:   System.Diagnostics
Assembly:  System (in System.dll)

System.Object
  System.Diagnostics.CorrelationManager

type CorrelationManager = class end

NameDescription
System_CAPS_pubpropertyActivityId

Gets or sets the identity for a global activity.

System_CAPS_pubpropertyLogicalOperationStack

Gets the logical operation stack from the call context.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodStartLogicalOperation()

Starts a logical operation on a thread.

System_CAPS_pubmethodStartLogicalOperation(Object)

Starts a logical operation with the specified identity on a thread.

System_CAPS_pubmethodStopLogicalOperation()

Stops the current logical operation.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

Traces generated from a single logical operation can be tagged with an operation-unique identity, in order to distinguish them from traces from a different logical operation. For example, it may be useful to group correlated traces by ASP.NET request. The CorrelationManager class provides methods used to store a logical operation identity in a thread-bound context and automatically tag each trace event generated by the thread with the stored identity.

Logical operations can also be nested. The LogicalOperationStack property exposes the stack of nested logical operation identities. Each call to the StartLogicalOperation method pushes a new logical operation identity onto the stack. Each call to the StopLogicalOperation method pops a logical operation identity off the stack.

System_CAPS_noteNote

Logical operation identities are objects, allowing the use of a type for a logical operation identity.

The following code example demonstrates the use of the CorrelationManager class by identifying the logical operation associated with a traced event. Two logical operations are started, one in the main thread and the other in a worker thread. An error event is logged in both logical operations.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: