This documentation is archived and is not being maintained.

<system.diagnostics> Element

Specifies trace listeners that collect, store, and route messages and the level where a trace switch is set.



Child Elements

Element Description
<assert> Specifies whether to display a message box when you call the Debug.Assert method; also specifies the name of the file to write messages to.
<switches> Contains trace switches and the levels where the trace switches are set.
<trace> Contains listeners that collect, store, and route tracing messages.


The following example shows how to embed a trace switch and a trace listener inside the <system.diagnostics> element. The General trace switch is set to the TraceLevel.Error level. The trace listener myListener creates a file called MyListener.log and writes the output to the file.

         <add name="General" value="4" />
      <trace autoflush="true" indentsize="2">
            <add name="myListener"   
                 type="System.Diagnostics.TextWriterTraceListener, Version, Culture, PublicKeyToken" 

Configuration File

This element can be used in the machine configuration file (Machine.config) and the application configuration file.

See Also

Trace and Debug Settings Schema | Trace Class | Debug Class