Share via


Classes Used in .NET Framework Logging

This topic contains tables listing the classes commonly used for .NET Framework logging and tracing. The tables are divided into log-output classes, log-listener classes, and log-filtering classes. To enter the .NET Framework 2.0 documentation and find a more comprehensive listing, see .NET Framework Class Library Overview.

Basic Classes for Log Output

The following table lists and describes the main classes used for log output.

Class

Description

Debug

Provides a set of methods and properties that help debug your code. This class cannot be inherited.

Trace

Provides a set of methods and properties that help you trace the execution of your code. This class cannot be inherited.

TraceSource

Provides a set of methods and properties that help you trace the execution of your code.

Log-Listener Classes

The following table lists and describes the main log-listener classes.

Class

Description

TraceListener

Provides the abstract base class for the listeners who monitor trace and debug output.

ConsoleTraceListener

Directs tracing or debugging output to either the standard output or the standard error stream.

DefaultTraceListener

Provides the default output methods and behavior for tracing.

DelimitedListTraceListener

Directs tracing or debugging output to a TextWriter, such as StreamWriter, or to a Stream, such as FileStream.

EventLogTraceListener

Provides a simple listener that directs tracing or debugging output to an EventLog.

FileLogTraceListener

Provides a simple listener that directs logging output to file.

TextWriterTraceListener

Directs tracing or debugging output to a TextWriter or to a Stream such as Out or FileStream.

XmlWriterTraceListener

Directs tracing or debugging output to a TextWriter or to a Stream such as FileStream.

Log Filtering and Switching Classes

The following table lists and describes the main log filtering and switching classes.

Class

Description

Switch

Provides an abstract base class to create new debugging and tracing switches.

BooleanSwitch

Provides a simple on/off switch that controls debugging and tracing output.

SourceSwitch

Provides a multilevel switch to control tracing and debug output without recompiling your code.

TraceSwitch

Provides a multilevel switch to control tracing and debug output without recompiling your code.

EventTypeFilter

Provides a severity level based switch that controls tracing output.

SourceFilter

Specifies if a listener should trace a message based on the source of a trace.

TraceFilter

Defines a method for trace-filter implementations.

See Also

Concepts

Logging and Tracing in the .NET Framework with Visual Basic

Basics of .NET Framework Logs

Reference

System.Diagnostics

Other Resources

Tracing and Instrumenting Applications