<add> Element for <switches>

Specifies the level where a trace switch is set.



<add name="switch name"  

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.


Attribute Description
name Required attribute.

Specifies the name of the switch. The value of this attribute corresponds to the displayName parameter that is passed to switch constructor.
value Required attribute.

Specifies the level of the switch.

Child Elements


Parent Elements

Element Description
configuration The root element in every configuration file used by the common language runtime and .NET Framework applications.
switches Contains trace switches and the level where the trace switches are set.
system.diagnostics Specifies trace listeners that collect, store, and route messages and the level where a trace switch is set.


You can change the level of a trace switch by putting it in a configuration file. If the switch is a BooleanSwitch, you can turn it on and off. If the switch is a TraceSwitch, you can assign different levels to it to specify the types of trace or debug messages the application outputs.


The following example shows how to use the <add> element to set the General trace switch to the TraceLevel level, and enable the Data Boolean trace switch.

         <add name="General" value="4" />  
         <add name="Data" value="1" />  

See also