Updated: February 2010
Directs tracing or debugging output to a text writer, such as a stream writer, or to a stream, such as a file stream.
Assembly: System (in System.dll)
The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: Synchronization. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.
The trace output is in a delimited text format that uses the delimiter specified by the Delimiter property. The delimiter is used to terminate each field in a line of output. For example, to display the trace output in a Microsoft Excel spreadsheet, you might specify a comma (",") as a delimiter and create a comma-separated value (CSV) file.
You can enable or disable a through the application configuration file and then use the configured in your application. Alternately, you can create a in your code.
The delimits only text that is emitted by using the methods that have names starting with the word Trace, such as DelimitedListTraceListener.TraceEvent or Trace.TraceWarning. Trace data that is emitted by using the Debug.Write and TextWriterTraceListener.WriteLine methods is not delimited.
To configure a , edit the configuration file that corresponds to the name of your application. In this file, you can add a listener, set the properties for a listener, or remove a listener. The configuration file should be formatted as shown in the following example:
<configuration> <system.diagnostics> <trace autoflush="false" indentsize="4"> <listeners> <add name="delimitedListener" type="System.Diagnostics.DelimitedListTraceListener" delimiter=":" initializeData="delimitedOutput.txt" traceOutputOptions="ProcessId, DateTime" /> <remove name="Default" /> </listeners> </trace> </system.diagnostics> </configuration>
If you try to write to a file that is in use or unavailable, the file name is automatically prefixed by a GUID.
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.