This documentation is archived and is not being maintained.

TraceOptions Enumeration

Specifies trace data options to be written to the trace output.

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

public enum TraceOptions
/** @attribute FlagsAttribute() */ 
public enum TraceOptions
public enum TraceOptions

 Member nameDescription
CallstackWrite the call stack, which is represented by the return value of the Environment.StackTrace property. 
DateTimeWrite the date and time.  
LogicalOperationStackWrite the logical operation stack, which is represented by the return value of the CorrelationManager.LogicalOperationStack property. 
NoneDo not write any elements. 
ProcessIdWrite the process identity, which is represented by the return value of the Process.Id property. 
ThreadIdWrite the thread identity, which is represented by the return value of the Thread.ManagedThreadId property for the current thread. 
TimestampWrite the timestamp, which is represented by the return value of the GetTimestamp method. 

This enumeration is used by trace listeners to determine which options, or elements, should be included in the trace output. Trace listeners store the trace options in the TraceOutputOptions property.

The following example shows the use of the traceOutputOptions attribute to specify the trace output options for a ConsoleTraceListener that is enabled using a configuration file.

    <trace autoflush="false" indentsize="4">
        <add name="consoleListener"
          traceOutputOptions="ProcessId, DateTime" />

For details about adding trace listeners in the application configuration file, see <listeners> Element.

The following code example shows the use of the TraceOptions enumeration to programmatically set the TraceOutputOptions property for a console trace listener. The console trace listener is one of the listeners enumerated in the Listeners property of a trace source. This code example is part of a larger example provided for the TraceSource class.

ts.Listeners["console"].TraceOutputOptions |= TraceOptions.Callstack;

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0