Specifies trace data options to be written to the trace output.
This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
Namespace:
System.Diagnostics
Assembly:
System (in System.dll)
Visual Basic (Declaration)
<FlagsAttribute> _
Public Enumeration TraceOptions
Dim instance As TraceOptions
[FlagsAttribute]
public enum TraceOptions
[FlagsAttribute]
public enum class TraceOptions
| Member name | Description |
|---|
| None | Do not write any elements. |
| LogicalOperationStack | Write the logical operation stack, which is represented by the return value of the CorrelationManager..::.LogicalOperationStack property. |
| DateTime | Write the date and time. |
| Timestamp | Write the timestamp, which is represented by the return value of the GetTimestamp method. |
| ProcessId | Write the process identity, which is represented by the return value of the Process..::.Id property. |
| ThreadId | Write the thread identity, which is represented by the return value of the Thread..::.ManagedThreadId property for the current thread. |
| Callstack | Write the call stack, which is represented by the return value of the Environment..::.StackTrace property. |
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.
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="consoleListener"
type="System.Diagnostics.ConsoleTraceListener"
traceOutputOptions="ProcessId, DateTime" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
For details about adding trace listeners to the application configuration file, see <listeners> Element for <trace>.
The TraceOptions enumeration is not used by the following classes and methods:
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 = ts.Listeners("console").TraceOutputOptions Or TraceOptions.Callstack
ts.Listeners["console"].TraceOutputOptions |= TraceOptions.Callstack;
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0
Reference