Compartilhar via


Custom Trace Listener Technology Sample

This sample provides a custom trace listener that generates system beeps, using Console.Beep, in response to events raised by button clicks from a Windows Forms application.

This sample builds CusomTraceListener.dll, a trace listener for the WinDriver.exe application. The trace listener and the application read values from a provided configuration file, WinDriver.exe.config, which lists the trace listeners of the application and includes values and settings for the tracing system.

For general information about using the samples, see the following topics:

To build the sample using the Command Prompt

  1. Open a Command Prompt window and navigate to the CustomTraceListener directory.

  2. Type msbuild CustomTraceListener.sln at the command line.

To build the sample using Visual Studio

  1. Open Windows Explorer and navigate to the CustomTraceListener directory.

  2. Double-click CustomTraceListener.sln to open the CustomTraceListener solution. This solution contains two projects: CustomTraceListener and WinDriver.

  3. In the Build menu, select Build Solution.

    This builds CustomTraceListener.dll and WinDriver.exe.

To run the sample

  1. Navigate to the bin\debug folder containing WinDriver.exe.

  2. Run WinDriver.exe.

  3. Click buttons in the application to raise events to be traced by CustomTraceListener.dll.

Requirements

.NET Framework Version: 2.0

Demonstrates

Diagnostics, Event tracing.

See Also

Reference

Trace
TraceListener