Table of Contents

Interface ILogger

Namespace
log4net.Core
Assembly
log4net.dll

Interface that all loggers implement

public interface ILogger

Remarks

This interface supports logging events and testing if a level is enabled for logging.

These methods will not throw exceptions. Note to implementor, ensure that the implementation of these methods cannot allow an exception to be thrown to the caller.

Properties

Name

Gets the name of the logger.

string Name { get; }

Property Value

string

The name of the logger.

Remarks

The name of this logger

Repository

Gets the ILoggerRepository where this Logger instance is attached to.

ILoggerRepository Repository { get; }

Property Value

ILoggerRepository

The ILoggerRepository that this logger belongs to.

Remarks

Gets the ILoggerRepository where this Logger instance is attached to.

Methods

IsEnabledFor(Level)

Checks if this logger is enabled for a given Level passed as parameter.

bool IsEnabledFor(Level level)

Parameters

level Level

The level to check.

Returns

bool

true if this logger is enabled for level, otherwise false.

Remarks

Test if this logger is going to log events of the specified level.

Log(Type, Level, object, Exception)

This generic form is intended to be used by wrappers.

void Log(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception)

Parameters

callerStackBoundaryDeclaringType Type

The declaring type of the method that is the stack boundary into the logging system for this call.

level Level

The level of the message to be logged.

message object

The message object to log.

exception Exception

the exception to log, including its stack trace. Pass null to not log an exception.

Remarks

Generates a logging event for the specified level using the message and exception.

Log(LoggingEvent)

This is the most generic printing method that is intended to be used by wrappers.

void Log(LoggingEvent logEvent)

Parameters

logEvent LoggingEvent

The event being logged.

Remarks

Logs the specified logging event through this logger.