Table of Contents

Interface ILoggerRepository

Namespace
log4net.Repository
Assembly
log4net.dll

Interface implemented by logger repositories.

public interface ILoggerRepository

Remarks

This interface is implemented by logger repositories. e.g. log4net.Repository.Hierarchy.

This interface is used by the LogManager to obtain ILog interfaces.

Properties

ConfigurationMessages

Collection of internal messages captured during the most recent configuration process.

ICollection ConfigurationMessages { get; set; }

Property Value

ICollection

Configured

Flag indicates if this repository has been configured.

bool Configured { get; set; }

Property Value

bool

Flag indicates if this repository has been configured.

Remarks

Flag indicates if this repository has been configured.

LevelMap

Get the level map for the Repository.

LevelMap LevelMap { get; }

Property Value

LevelMap

Remarks

Get the level map for the Repository.

The level map defines the mappings between level names and Level objects in this repository.

Name

The name of the repository

string Name { get; set; }

Property Value

string

The name of the repository

Remarks

The name of the repository.

PluginMap

The plugin map for this repository.

PluginMap PluginMap { get; }

Property Value

PluginMap

The plugin map for this repository.

Remarks

The plugin map holds the IPlugin instances that have been attached to this repository.

Properties

Repository specific properties

PropertiesDictionary Properties { get; }

Property Value

PropertiesDictionary

Repository specific properties

Remarks

These properties can be specified on a repository specific basis.

RendererMap

RendererMap accesses the object renderer map for this repository.

RendererMap RendererMap { get; }

Property Value

RendererMap

RendererMap accesses the object renderer map for this repository.

Remarks

RendererMap accesses the object renderer map for this repository.

The RendererMap holds a mapping between types and IObjectRenderer objects.

Threshold

The threshold for all events in this repository

Level Threshold { get; set; }

Property Value

Level

The threshold for all events in this repository

Remarks

The threshold for all events in this repository.

Methods

Exists(string)

Check if the named logger exists in the repository. If so return its reference, otherwise returns null.

ILogger Exists(string name)

Parameters

name string

The name of the logger to lookup

Returns

ILogger

The Logger object with the name specified

Remarks

If the names logger exists it is returned, otherwise null is returned.

GetAppenders()

Returns all the Appenders that are configured as an Array.

IAppender[] GetAppenders()

Returns

IAppender[]

All the Appenders

Remarks

Returns all the Appenders that are configured as an Array.

GetCurrentLoggers()

Returns all the currently defined loggers as an Array.

ILogger[] GetCurrentLoggers()

Returns

ILogger[]

All the defined loggers

Remarks

Returns all the currently defined loggers as an Array.

GetLogger(string)

Returns a named logger instance

ILogger GetLogger(string name)

Parameters

name string

The name of the logger to retrieve

Returns

ILogger

The logger object with the name specified

Remarks

Returns a named logger instance.

If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children.

Log(LoggingEvent)

Log the LoggingEvent through this repository.

void Log(LoggingEvent logEvent)

Parameters

logEvent LoggingEvent

the event to log

Remarks

This method should not normally be used to log. The ILog interface should be used for routine logging. This interface can be obtained using the log4net.LogManager.GetLogger(string) method.

The logEvent is delivered to the appropriate logger and that logger is then responsible for logging the event.

ResetConfiguration()

Reset the repositories configuration to a default state

void ResetConfiguration()

Remarks

Reset all values contained in this instance to their default state.

Existing loggers are not removed. They are just reset.

This method should be used sparingly and with care as it will block all logging until it is completed.

Shutdown()

Shutdown the repository

void Shutdown()

Remarks

Shutting down a repository will safely close and remove all appenders in all loggers including the root logger.

Some appenders need to be closed before the application exists. Otherwise, pending logging events might be lost.

The Shutdown() method is careful to close nested appenders before closing regular appenders. This is allows configurations where a regular appender is attached to a logger and again to a nested appender.

Events

ConfigurationChanged

Event to notify that the repository has had its configuration changed.

event LoggerRepositoryConfigurationChangedEventHandler ConfigurationChanged

Event Type

LoggerRepositoryConfigurationChangedEventHandler

Event to notify that the repository has had its configuration changed.

Remarks

Event raised when the repository's configuration has been changed.

ConfigurationReset

Event to notify that the repository has had its configuration reset.

event LoggerRepositoryConfigurationResetEventHandler ConfigurationReset

Event Type

LoggerRepositoryConfigurationResetEventHandler

Event to notify that the repository has had its configuration reset.

Remarks

Event raised when the repository's configuration has been reset to default.

ShutdownEvent

Event to notify that the repository has been shutdown.

event LoggerRepositoryShutdownEventHandler ShutdownEvent

Event Type

LoggerRepositoryShutdownEventHandler

Event to notify that the repository has been shutdown.

Remarks

Event raised when the repository has been shutdown.