System.Diagnostics.Trace.Listeners Property

Gets the collection of listeners that is monitoring the trace output.

Syntax

public static TraceListenerCollection Listeners { get; }

Value

The list of System.Diagnostics.TraceListener objects to forward messages to.

Remarks

The listeners produce formatted output from the trace output. By default, the collection contains an instance of the System.Diagnostics.DefaultTraceListener class. If you want to remove the default listener, call the TraceListenerCollection.Remove(string) method, and pass it the instance of the System.Diagnostics.DefaultTraceListener. To redirect output to the console window, add an instance of the System.Diagnostics.ConsoleTraceListener class.

Note:

The Trace.Listeners collection is shared by both the System.Diagnostics.Debug and the System.Diagnostics.Trace classes; adding a trace listener to either class adds the listener to both.

Requirements

Namespace: System.Diagnostics
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0