ILog Interface | Apache log4net™ SDK Documentation

The ILog interface is use by application to log messages into the log4net framework.

Namespace: log4net
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    public interface ILog : ILoggerWrapper

    Public Interface ILog
    	Inherits ILoggerWrapper

    public interface class ILog : ILoggerWrapper

    type ILog =
        interface
            interface ILoggerWrapper
        end

The ILog type exposes the following members.

Properties

| Name | Description
--- | --- | ---
| IsDebugEnabled | Checks if this logger is enabled for the Debug level.
| IsErrorEnabled | Checks if this logger is enabled for the Error level.
| IsFatalEnabled | Checks if this logger is enabled for the Fatal level.
| IsInfoEnabled | Checks if this logger is enabled for the Info level.
| IsWarnEnabled | Checks if this logger is enabled for the Warn level.
| Logger | Get the implementation behind this wrapper object. (Inherited from ILoggerWrapper.)

Top
Methods

| Name | Description
--- | --- | ---
| Debug(Object) | Log a message object with the Debug level.
| Debug(Object, Exception) | Log a message object with the Debug level including the stack trace of the Exception passed as a parameter.
| DebugFormat(String, Object) | Logs a formatted message string with the Debug level.
| DebugFormat(String, Object ) | Logs a formatted message string with the Debug level.
| DebugFormat(IFormatProvider, String, Object ) | Logs a formatted message string with the Debug level.
| DebugFormat(String, Object, Object) | Logs a formatted message string with the Debug level.
| DebugFormat(String, Object, Object, Object) | Logs a formatted message string with the Debug level.
| Error(Object) | Logs a message object with the Error level.
| Error(Object, Exception) | Log a message object with the Error level including the stack trace of the Exception passed as a parameter.
| ErrorFormat(String, Object) | Logs a formatted message string with the Error level.
| ErrorFormat(String, Object ) | Logs a formatted message string with the Error level.
| ErrorFormat(IFormatProvider, String, Object ) | Logs a formatted message string with the Error level.
| ErrorFormat(String, Object, Object) | Logs a formatted message string with the Error level.
| ErrorFormat(String, Object, Object, Object) | Logs a formatted message string with the Error level.
| Fatal(Object) | Log a message object with the Fatal level.
| Fatal(Object, Exception) | Log a message object with the Fatal level including the stack trace of the Exception passed as a parameter.
| FatalFormat(String, Object) | Logs a formatted message string with the Fatal level.
| FatalFormat(String, Object ) | Logs a formatted message string with the Fatal level.
| FatalFormat(IFormatProvider, String, Object ) | Logs a formatted message string with the Fatal level.
| FatalFormat(String, Object, Object) | Logs a formatted message string with the Fatal level.
| FatalFormat(String, Object, Object, Object) | Logs a formatted message string with the Fatal level.
| Info(Object) | Logs a message object with the Info level.
| Info(Object, Exception) | Logs a message object with the INFO level including the stack trace of the Exception passed as a parameter.
| InfoFormat(String, Object) | Logs a formatted message string with the Info level.
| InfoFormat(String, Object ) | Logs a formatted message string with the Info level.
| InfoFormat(IFormatProvider, String, Object ) | Logs a formatted message string with the Info level.
| InfoFormat(String, Object, Object) | Logs a formatted message string with the Info level.
| InfoFormat(String, Object, Object, Object) | Logs a formatted message string with the Info level.
| Warn(Object) | Log a message object with the Warn level.
| Warn(Object, Exception) | Log a message object with the Warn level including the stack trace of the Exception passed as a parameter.
| WarnFormat(String, Object) | Logs a formatted message string with the Warn level.
| WarnFormat(String, Object ) | Logs a formatted message string with the Warn level.
| WarnFormat(IFormatProvider, String, Object ) | Logs a formatted message string with the Warn level.
| WarnFormat(String, Object, Object) | Logs a formatted message string with the Warn level.
| WarnFormat(String, Object, Object, Object) | Logs a formatted message string with the Warn level.

Top
Extension Methods

| Name | Description
--- | --- | ---
| DebugExt(Func TResult ) | Overloaded. (Defined by ILogExtensions.)
| DebugExt(Object) | Overloaded. Log a message object with the Debug level. (Defined by ILogExtensions.)
| DebugExt(Func TResult , Void) | Overloaded. (Defined by ILogExtensions.)
| DebugExt(Object, Exception) | Overloaded. Log a message object with the Debug level including the stack trace of the Exception passed as a parameter. (Defined by ILogExtensions.)
| DebugFormatExt(String, Object) | Overloaded. Logs a formatted message string with the Debug level. (Defined by ILogExtensions.)
| DebugFormatExt(String, Object ) | Overloaded. Logs a formatted message string with the Debug level. (Defined by ILogExtensions.)
| DebugFormatExt(IFormatProvider, String, Object ) | Overloaded. Logs a formatted message string with the Debug level. (Defined by ILogExtensions.)
| DebugFormatExt(String, Object, Object) | Overloaded. Logs a formatted message string with the Debug level. (Defined by ILogExtensions.)
| DebugFormatExt(String, Object, Object, Object) | Overloaded. Logs a formatted message string with the Debug level. (Defined by ILogExtensions.)
| ErrorExt(Func TResult ) | Overloaded. (Defined by ILogExtensions.)
| ErrorExt(Object) | Overloaded. Log a message object with the Error level. (Defined by ILogExtensions.)
| ErrorExt(Func TResult , Void) | Overloaded. (Defined by ILogExtensions.)
| ErrorExt(Object, Exception) | Overloaded. Log a message object with the Error level including the stack trace of the Exception passed as a parameter. (Defined by ILogExtensions.)
| ErrorFormatExt(String, Object) | Overloaded. Logs a formatted message string with the Error level. (Defined by ILogExtensions.)
| ErrorFormatExt(String, Object ) | Overloaded. Logs a formatted message string with the Error level. (Defined by ILogExtensions.)
| ErrorFormatExt(IFormatProvider, String, Object ) | Overloaded. Logs a formatted message string with the Error level. (Defined by ILogExtensions.)
| ErrorFormatExt(String, Object, Object) | Overloaded. Logs a formatted message string with the Error level. (Defined by ILogExtensions.)
| ErrorFormatExt(String, Object, Object, Object) | Overloaded. Logs a formatted message string with the Error level. (Defined by ILogExtensions.)
| FatalExt(Func TResult ) | Overloaded. (Defined by ILogExtensions.)
| FatalExt(Object) | Overloaded. Log a message object with the Fatal level. (Defined by ILogExtensions.)
| FatalExt(Func TResult , Void) | Overloaded. (Defined by ILogExtensions.)
| FatalExt(Object, Exception) | Overloaded. Log a message object with the Fatal level including the stack trace of the Exception passed as a parameter. (Defined by ILogExtensions.)
| FatalFormatExt(String, Object) | Overloaded. Logs a formatted message string with the Fatal level. (Defined by ILogExtensions.)
| FatalFormatExt(String, Object ) | Overloaded. Logs a formatted message string with the Fatal level. (Defined by ILogExtensions.)
| FatalFormatExt(IFormatProvider, String, Object ) | Overloaded. Logs a formatted message string with the Fatal level. (Defined by ILogExtensions.)
| FatalFormatExt(String, Object, Object) | Overloaded. Logs a formatted message string with the Fatal level. (Defined by ILogExtensions.)
| FatalFormatExt(String, Object, Object, Object) | Overloaded. Logs a formatted message string with the Fatal level. (Defined by ILogExtensions.)
| InfoExt(Func TResult ) | Overloaded. (Defined by ILogExtensions.)
| InfoExt(Object) | Overloaded. Log a message object with the Info level. (Defined by ILogExtensions.)
| InfoExt(Func TResult , Void) | Overloaded. (Defined by ILogExtensions.)
| InfoExt(Object, Exception) | Overloaded. Log a message object with the Info level including the stack trace of the Exception passed as a parameter. (Defined by ILogExtensions.)
| InfoFormatExt(String, Object) | Overloaded. Logs a formatted message string with the Info level. (Defined by ILogExtensions.)
| InfoFormatExt(String, Object ) | Overloaded. Logs a formatted message string with the Info level. (Defined by ILogExtensions.)
| InfoFormatExt(IFormatProvider, String, Object ) | Overloaded. Logs a formatted message string with the Info level. (Defined by ILogExtensions.)
| InfoFormatExt(String, Object, Object) | Overloaded. Logs a formatted message string with the Info level. (Defined by ILogExtensions.)
| InfoFormatExt(String, Object, Object, Object) | Overloaded. Logs a formatted message string with the Info level. (Defined by ILogExtensions.)
| WarnExt(Func TResult ) | Overloaded. (Defined by ILogExtensions.)
| WarnExt(Object) | Overloaded. Log a message object with the Warn level. (Defined by ILogExtensions.)
| WarnExt(Func TResult , Void) | Overloaded. (Defined by ILogExtensions.)
| WarnExt(Object, Exception) | Overloaded. Log a message object with the Warn level including the stack trace of the Exception passed as a parameter. (Defined by ILogExtensions.)
| WarnFormatExt(String, Object) | Overloaded. Logs a formatted message string with the Warn level. (Defined by ILogExtensions.)
| WarnFormatExt(String, Object ) | Overloaded. Logs a formatted message string with the Warn level. (Defined by ILogExtensions.)
| WarnFormatExt(IFormatProvider, String, Object ) | Overloaded. Logs a formatted message string with the Warn level. (Defined by ILogExtensions.)
| WarnFormatExt(String, Object, Object) | Overloaded. Logs a formatted message string with the Warn level. (Defined by ILogExtensions.)
| WarnFormatExt(String, Object, Object, Object) | Overloaded. Logs a formatted message string with the Warn level. (Defined by ILogExtensions.)

Top
Remarks

Use the LogManager to obtain logger instances that implement this interface. The GetLogger(Assembly, Type) static method is used to get logger instances.

This class contains methods for logging at different levels and also has properties for determining if those logging levels are enabled in the current configuration.

This interface can be implemented in different ways. This documentation specifies reasonable behavior that a caller can expect from the actual implementation, however different implementations reserve the right to do things differently.

Examples

Simple example of logging messages
C#
Copy

    ILog log = LogManager.GetLogger("application-log");

    log.Info("Application Start");
    log.Debug("This is a debug message");

    if (log.IsDebugEnabled)
    {
        log.Debug("This is another debug message");
    }

See Also

#### Reference

log4net Namespace
log4net
LogManager
[M:LogManager.GetLogger(Assembly, Type)]