Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

<remove> Element for <listeners> for <trace> 

Removes a listener from the Listeners collection.


<remove name="listener name" />

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

Attributes

Attribute Description

name

Required attribute.

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

Child Elements

None.

Parent Elements

Element Description

configuration

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

listeners

Specifies a listener that collects, stores, and routes messages. Listeners direct the tracing output to an appropriate target.

system.diagnostics

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

trace

Configures the ASP.NET trace service.

NoteNote

Removing the DefaultTraceListener from the Listeners collection alters the behavior of the System.Diagnostics.Debug.Assert, System.Diagnostics.Trace.Assert, System.Diagnostics.Debug.Fail, and System.Diagnostics.Trace.Fail methods. Calling an Assert or Fail method normally results in the display of a message box, however the message box is not displayed if the DefaultTraceListener is not in the Listeners collection.

The following example shows how to remove the default trace listener from the trace Listeners collection.

<configuration>
   <system.diagnostics>
      <trace autoflush="true" indentsize="0">
         <listeners>
            <remove name="Default" />
         </listeners>
      </trace>
   </system.diagnostics>
</configuration>
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.