System 2.0.0.0 4.0.0.0 System.Diagnostics.TextWriterTraceListener

The trace output is in a delimited text format that uses the delimiter specified by the 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 or . Trace data that is emitted by using the and 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.csv" traceOutputOptions="ProcessId, DateTime" /> </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.

Listeners are intended to be used by methods of the , , and classes to write trace information. Listener methods, except for constructors, should not be called directly from application code.

Directs tracing or debugging output to a text writer, such as a stream writer, or to a stream, such as a file stream.

- Constructor
  2.0.0.0
  4.0.0.0

  This constructor initializes the property to an empty string ("").

  Initializes a new instance of the class that writes to the specified output stream.

  The to receive the output.
- Constructor
  2.0.0.0
  4.0.0.0

  This constructor initializes the property to an empty string ("").

  Initializes a new instance of the class that writes to the specified text writer.

  The to receive the output.
- Constructor
  2.0.0.0
  4.0.0.0

  This constructor initializes the property to an empty string ("").

  Initializes a new instance of the class that writes to the specified file.

  The name of the file to receive the output.
- Constructor
  2.0.0.0
  4.0.0.0

  This constructor initializes the property to the value of the parameter, or to an empty string ("") if the parameter is null. The property can be used as an index into the Listeners collection to programmatically change the properties for the listener. For example, the following code sets the property for the instance of that has the name "delimListener":

  ((DelimitedListTraceListener)Trace.Listeners["delimListener"]).Delimiter = ":"

  Initializes a new instance of the class that writes to the specified output stream and has the specified name.

  The to receive the output.
  The name of the new instance of the trace listener.
- Constructor
  2.0.0.0
  4.0.0.0

  This constructor initializes the property to the value of the parameter, or to an empty string ("") if the parameter is null. The property can be used as an index into the Listeners collection to programmatically change the properties for the listener. For example the following code sets the property for the instance of that has the name "delimListener":

  ((DelimitedListTraceListener)Trace.Listeners["delimListener"]).Delimiter = ":"

  Initializes a new instance of the class that writes to the specified text writer and has the specified name.

  The to receive the output.
  The name of the new instance of the trace listener.
- Constructor
  2.0.0.0
  4.0.0.0

  This constructor initializes a new instance of the class for the specified file on the specified path, using encoding. If the file exists, it is appended to. If the file does not exist, a new file is created.

  To reduce the chance of an exception, any character that might invalidate the output is replaced with a "?" character.

  The property is set to the value of the parameter, or to an empty string ("") if the parameter is null. The property can be used as an index into the Listeners collection to programmatically change the properties for the listener. For example, the following code sets the property for the instance of that has the name "delimListener":

  ((DelimitedListTraceListener)Trace.Listeners["delimListener"]).Delimiter = ":"

  Initializes a new instance of the class that writes to the specified file and has the specified name.

  The name of the file to receive the output.
  The name of the new instance of the trace listener.
- Property
  2.0.0.0
  4.0.0.0
  System.String To be added.

  The default delimiter is ";" (semicolon). The following configuration file example shows the setting of the property using the delimiter attribute in a configuration file:

  `<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>`

  Gets or sets the delimiter for the delimited list.

- Method
  2.0.0.0
  4.0.0.0
  System.String[]

  A custom attribute is an attribute that is not inherited from the base class that can be used to set a property for the class. The custom attribute for is used to set the property. The following configuration file example shows the use of the delimiter attribute to set the property:

  `<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>`

  Returns the custom configuration file attribute supported by the delimited trace listener.

  A string array that contains the single value "delimiter".

- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` ``

  The values of the , , and parameters are written as a header. The data object is converted to a string using the ToString method of the object. The data is written as a footer whose content depends on the value of the property.

  The method is not intended to be called by application code. It is called by methods of the , , and classes to write trace data.

  Writes trace information, a data object, and event information to the output file or stream.

  A object that contains the current process ID, thread ID, and stack trace information. A name used to identify the output, typically the name of the application that generated the trace event. One of the values specifying the type of event that has caused the trace. A numeric identifier for the event. A data object to write to the output file or stream.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` `System.ParamArray`

  The values of the , , and parameters are written as a header. The data objects are converted to strings using the ToString method of each object. The data is written as a footer whose content depends on the value of the property.

  The method is not intended to be called by application code. It is called by methods of the , , and classes to write trace data.

  Writes trace information, an array of data objects, and event information to the output file or stream.

  A object that contains the current process ID, thread ID, and stack trace information. A name used to identify the output, typically the name of the application that generated the trace event. One of the values specifying the type of event that has caused the trace. A numeric identifier for the event. An array of data objects to write to the output file or stream.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` ``

  The values of the , , and parameters are written as a header, followed by the data. The data is written as a footer whose content depends on the value of the property.

  The method is not intended to be called by application code. It is called by methods of the , , and classes to write trace data.

  Writes trace information, a message, and event information to the output file or stream.

  A object that contains the current process ID, thread ID, and stack trace information. A name used to identify the output, typically the name of the application that generated the trace event. One of the values specifying the type of event that has caused the trace. A numeric identifier for the event. The trace message to write to the output file or stream.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` `` `System.ParamArray`

  The values of the , , and parameters are written as a header. The object array is converted to a string using the method, passing the string and array to format the string as the message portion of the trace. The data is written as a footer whose content depends on the value of the property.

  The method is not intended to be called by application code. It is called by methods of the , , and classes to write trace data.

  Writes trace information, a formatted array of objects, and event information to the output file or stream.

  A object that contains the current process ID, thread ID, and stack trace information. A name used to identify the output, typically the name of the application that generated the trace event. One of the values specifying the type of event that has caused the trace. A numeric identifier for the event. A format string that contains zero or more format items that correspond to objects in the array. An array containing zero or more objects to format.