Table of Contents

Class LoggingConfiguration

Namespace
Microsoft.Practices.EnterpriseLibrary.Logging
Assembly
Microsoft.Practices.EnterpriseLibrary.Logging.dll

Represents the configuration options for the Logging Application Block.

public sealed class LoggingConfiguration
Inheritance
LoggingConfiguration
Inherited Members

Constructors

LoggingConfiguration()

Initializes a new instance of the LoggingConfiguration class.

public LoggingConfiguration()

Properties

AllTraceListeners

Gets a collection of all the TraceListener objects used in this configuration.

public IEnumerable<TraceListener> AllTraceListeners { get; }

Property Value

IEnumerable<TraceListener>

DefaultSource

Gets or sets the default source name.

public string DefaultSource { get; set; }

Property Value

string

Filters

Gets the list of all available ILogFilter objects.

public IList<ILogFilter> Filters { get; }

Property Value

IList<ILogFilter>

IsLoggingEnabled

Gets or sets a value that indicates whether logging is enabled.

public bool IsLoggingEnabled { get; set; }

Property Value

bool

IsTracingEnabled

Gets or sets a value that indicates whether tracing is enabled.

public bool IsTracingEnabled { get; set; }

Property Value

bool

LogSources

Gets the collection of all available LogSource objects.

public LogSourceDataCollection LogSources { get; }

Property Value

LogSourceDataCollection

LogWarningsWhenNoCategoriesMatch

Gets or sets a value that indicates whether to log warnings when no matching categories are found.

public bool LogWarningsWhenNoCategoriesMatch { get; set; }

Property Value

bool

SpecialSources

Gets the configuration for special sources.

public SpecialSourcesConfiguration SpecialSources { get; }

Property Value

SpecialSourcesConfiguration

UseImpersonation

Gets or sets a value indicating whether to use impersonation.

public bool UseImpersonation { get; set; }

Property Value

bool

Methods

AddLogSource(string)

Adds a new log source with the specified name.

public LogSourceData AddLogSource(string name)

Parameters

name string

The name of the log source.

Returns

LogSourceData

A new LogSourceData instance.

AddLogSource(string, SourceLevels)

Adds a new log source with the specified name and level.

public LogSourceData AddLogSource(string name, SourceLevels level)

Parameters

name string

The name of the log source.

level SourceLevels

The filtering level of the log source.

Returns

LogSourceData

A new LogSourceData instance.

AddLogSource(string, SourceLevels, bool)

Adds a new log source with the specified name and level, and optionally enables auto-flush.

public LogSourceData AddLogSource(string name, SourceLevels level, bool autoFlush)

Parameters

name string

The name of the log source.

level SourceLevels

The filtering level of the log source.

autoFlush bool

true to enable auto-flush; otherwise, false.

Returns

LogSourceData

A new LogSourceData instance.

AddLogSource(string, SourceLevels, bool, params TraceListener[])

Adds a new log source with the specified name, level, and trace listeners, and optionally enables auto-flush.

public LogSourceData AddLogSource(string name, SourceLevels level, bool autoFlush, params TraceListener[] traceListeners)

Parameters

name string

The name of the log source.

level SourceLevels

The filtering level of the log source.

autoFlush bool

true to enable auto-flush; otherwise, false.

traceListeners TraceListener[]

One or more TraceListener objects.

Returns

LogSourceData

A new LogSourceData instance.

AddLogSource(string, params TraceListener[])

Adds a new log source with the specified name and trace listeners.

public LogSourceData AddLogSource(string name, params TraceListener[] traceListeners)

Parameters

name string

The name of the log source.

traceListeners TraceListener[]

One or more TraceListener objects.

Returns

LogSourceData

A new LogSourceData instance.