The trace output is in a delimited text format that uses the delimiter specified by the Delimiter property.
You can enable or disable a DelimitedListTraceListener through the application configuration file and then use the configured DelimitedListTraceListener in your application. Alternately, you can create a DelimitedListTraceListener in your code.
To configure a DelimitedListTraceListener, 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 like 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> Note: |
|---|
If an attempt is made to write to a file that is in use or unavailable, the file name is automatically prefixed by a GUID.
|
Note: |
|---|
Listeners are intended to be used by methods of the
Debug, Trace, and TraceSource classes to write trace information. Listener methods, other than constructors, are not intended to be called directly from application code.
|