The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

<remove> Element for <listeners> for <source> 

Removes a listener from the Listeners collection for a trace source.

<remove name="listenerName" />

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


Attribute Description


Required attribute.

The name of the listener to remove from the Listeners collection.

Child Elements


Parent Elements

Element Description


The root element in every configuration file used by the common language runtime and .NET Framework applications.


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


Contains trace sources that initiate tracing messages.


Specifies a trace source that initiates tracing messages.


Specifies listeners that collect, store, and route messages.

The <remove> element removes a specified listener from the Listeners collection for a trace source.

You can remove an element from the Listeners collection for a trace source programmatically by calling the Remove method on the Listeners property of the TraceSource instance.

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

The following example shows how to use the <remove> element before using the <add> element to add the listener console to the Listeners collection for the trace source TraceSourceApp.

      <source name="TraceSourceApp" switchName="sourceSwitch" 
         switchType="System.Diagnostics.SourceSwitch" >
           <remove name="Default"/>
           <add name="console" 
             type="System.Diagnostics.ConsoleTraceListener" />
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft