Table of Contents

Class TraceListenerData

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

Represents the configuration for a TraceListener.

public class TraceListenerData : NameTypeConfigurationElement
Inheritance
TraceListenerData
Derived

Remarks

Since trace listeners are not under our control, the building mechanism can't rely on annotations to the trace listeners to determine the concrete TraceListenerData subtype when deserializing. Because of this, the schema for TraceListenerData includes the actual type of the instance to build.

Constructors

TraceListenerData()

Initializes an instance of the TraceListenerData class.

public TraceListenerData()

TraceListenerData(string, Type, TraceOptions)

Initializes an instance of TraceListenerData with a name and TraceOptions for a TraceListenerType.

protected TraceListenerData(string name, Type traceListenerType, TraceOptions traceOutputOptions)

Parameters

name string

The name for the instance.

traceListenerType Type

The trace listener type.

traceOutputOptions TraceOptions

The trace options.

TraceListenerData(string, Type, TraceOptions, SourceLevels)

Initializes an instance of TraceListenerData with a name, a TraceOptions for a TraceListenerType and a SourceLevels for a Filter.

protected TraceListenerData(string name, Type traceListenerType, TraceOptions traceOutputOptions, SourceLevels filter)

Parameters

name string

The name for the instance.

traceListenerType Type

The trace listener type.

traceOutputOptions TraceOptions

The trace options.

filter SourceLevels

The filter.

TraceListenerData(Type)

Initializes an instance of TraceListenerData for the given traceListenerType.

public TraceListenerData(Type traceListenerType)

Parameters

traceListenerType Type

Type of trace listener this element represents.

Fields

asynchronousBufferSizeProperty

Name of the property that holds the asynchronous buffer size of a TraceListenerData

protected const string asynchronousBufferSizeProperty = "asynchronousBufferSize"

Field Value

string

asynchronousDisposeTimeoutProperty

Name of the property that holds the asynchronous dispose timeout of a TraceListenerData

protected const string asynchronousDisposeTimeoutProperty = "asynchronousDisposeTimeout"

Field Value

string

asynchronousMaxDegreeOfParallelismProperty

Name of the property that holds the asynchronous max degree of parallelism of a TraceListenerData

protected const string asynchronousMaxDegreeOfParallelismProperty = "asynchronousDegreeOfParallelism"

Field Value

string

asynchronousProperty

Name of the property that holds the asynchronous flag of a TraceListenerData

protected const string asynchronousProperty = "asynchronous"

Field Value

string

filterProperty

Name of the property that holds the Filter of a TraceListenerData

protected const string filterProperty = "filter"

Field Value

string

listenerDataTypeProperty

Name of the property that holds the type for a TraceListenerData.

protected const string listenerDataTypeProperty = "listenerDataType"

Field Value

string

Remarks

This property will hold the type of the object it holds it. However, it's used during the deserialization process when the actual type of configuration element to create has to be determined.

traceOutputOptionsProperty

Name of the property that holds the TraceOptions of a TraceListenerData.

protected const string traceOutputOptionsProperty = "traceOutputOptions"

Field Value

string

Properties

Asynchronous

Gets or sets the asynchronous flag for the represented TraceListener

public bool Asynchronous { get; set; }

Property Value

bool

AsynchronousBufferSize

Gets or sets the asynchronous buffer size for the represented TraceListener

public int AsynchronousBufferSize { get; set; }

Property Value

int

AsynchronousDisposeTimeout

Gets or sets the asynchronous dispose timeout for the represented TraceListener

[TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
public TimeSpan AsynchronousDisposeTimeout { get; set; }

Property Value

TimeSpan

AsynchronousMaxDegreeOfParallelism

Gets or sets the asynchronous max degree of parallelism for the represented TraceListener

public int? AsynchronousMaxDegreeOfParallelism { get; set; }

Property Value

int?

Filter

Gets or sets the Filter for the represented TraceListener

public SourceLevels Filter { get; set; }

Property Value

SourceLevels

ListenerDataType

Gets or sets the type of the actual TraceListenerData type.

public Type ListenerDataType { get; set; }

Property Value

Type

Remarks

Should match the this.GetType().

ListenerDataTypeName

Gets or sets the fully qualified name of the actual TraceListenerData type.

[Browsable(false)]
public string ListenerDataTypeName { get; set; }

Property Value

string

the fully qualified name of the actual TraceListenerData type.

TraceOutputOptions

Gets or sets the TraceOptions for the represented TraceListener.

public TraceOptions TraceOutputOptions { get; set; }

Property Value

TraceOptions

Methods

BuildFormatterSafe(LoggingSettings, string)

Builds the log formatter represented by the name formatterName in settings.

protected ILogFormatter BuildFormatterSafe(LoggingSettings settings, string formatterName)

Parameters

settings LoggingSettings

The logging settings.

formatterName string

The formatter name, or a null or empty string.

Returns

ILogFormatter

A new formatter if formatterName is not null or empty; otherwise, null.

BuildTraceListener(LoggingSettings)

Builds the TraceListener object represented by this configuration object.

public TraceListener BuildTraceListener(LoggingSettings settings)

Parameters

settings LoggingSettings

The logging configuration settings.

Returns

TraceListener

A trace listener.

CoreBuildTraceListener(LoggingSettings)

Builds the TraceListener object represented by this configuration object.

protected virtual TraceListener CoreBuildTraceListener(LoggingSettings settings)

Parameters

settings LoggingSettings

The logging configuration settings.

Returns

TraceListener

A trace listener.