ILog InterfaceApache 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.6.0-.NET 4.0
Syntax

public interface ILog : ILoggerWrapper

The ILog type exposes the following members.

Properties

  NameDescription
Public propertyIsDebugEnabled
Checks if this logger is enabled for the Debug level.
Public propertyIsErrorEnabled
Checks if this logger is enabled for the Error level.
Public propertyIsFatalEnabled
Checks if this logger is enabled for the Fatal level.
Public propertyIsInfoEnabled
Checks if this logger is enabled for the Info level.
Public propertyIsWarnEnabled
Checks if this logger is enabled for the Warn level.
Public propertyLogger
Get the implementation behind this wrapper object.
(Inherited from ILoggerWrapper.)
Top
Methods

  NameDescription
Public methodDebug(Object)
Log a message object with the Debug level.
Public methodDebug(Object, Exception)
Log a message object with the Debug level including the stack trace of the Exception passed as a parameter.
Public methodDebugFormat(String, Object)
Logs a formatted message string with the Debug level.
Public methodDebugFormat(String, Object)
Logs a formatted message string with the Debug level.
Public methodDebugFormat(IFormatProvider, String, Object)
Logs a formatted message string with the Debug level.
Public methodDebugFormat(String, Object, Object)
Logs a formatted message string with the Debug level.
Public methodDebugFormat(String, Object, Object, Object)
Logs a formatted message string with the Debug level.
Public methodError(Object)
Logs a message object with the Error level.
Public methodError(Object, Exception)
Log a message object with the Error level including the stack trace of the Exception passed as a parameter.
Public methodErrorFormat(String, Object)
Logs a formatted message string with the Error level.
Public methodErrorFormat(String, Object)
Logs a formatted message string with the Error level.
Public methodErrorFormat(IFormatProvider, String, Object)
Logs a formatted message string with the Error level.
Public methodErrorFormat(String, Object, Object)
Logs a formatted message string with the Error level.
Public methodErrorFormat(String, Object, Object, Object)
Logs a formatted message string with the Error level.
Public methodFatal(Object)
Log a message object with the Fatal level.
Public methodFatal(Object, Exception)
Log a message object with the Fatal level including the stack trace of the Exception passed as a parameter.
Public methodFatalFormat(String, Object)
Logs a formatted message string with the Fatal level.
Public methodFatalFormat(String, Object)
Logs a formatted message string with the Fatal level.
Public methodFatalFormat(IFormatProvider, String, Object)
Logs a formatted message string with the Fatal level.
Public methodFatalFormat(String, Object, Object)
Logs a formatted message string with the Fatal level.
Public methodFatalFormat(String, Object, Object, Object)
Logs a formatted message string with the Fatal level.
Public methodInfo(Object)
Logs a message object with the Info level.
Public methodInfo(Object, Exception)
Logs a message object with the INFO level including the stack trace of the Exception passed as a parameter.
Public methodInfoFormat(String, Object)
Logs a formatted message string with the Info level.
Public methodInfoFormat(String, Object)
Logs a formatted message string with the Info level.
Public methodInfoFormat(IFormatProvider, String, Object)
Logs a formatted message string with the Info level.
Public methodInfoFormat(String, Object, Object)
Logs a formatted message string with the Info level.
Public methodInfoFormat(String, Object, Object, Object)
Logs a formatted message string with the Info level.
Public methodWarn(Object)
Log a message object with the Warn level.
Public methodWarn(Object, Exception)
Log a message object with the Warn level including the stack trace of the Exception passed as a parameter.
Public methodWarnFormat(String, Object)
Logs a formatted message string with the Warn level.
Public methodWarnFormat(String, Object)
Logs a formatted message string with the Warn level.
Public methodWarnFormat(IFormatProvider, String, Object)
Logs a formatted message string with the Warn level.
Public methodWarnFormat(String, Object, Object)
Logs a formatted message string with the Warn level.
Public methodWarnFormat(String, Object, Object, Object)
Logs a formatted message string with the Warn level.
Top
Extension Methods

  NameDescription
Public Extension MethodDebugExt(FuncTResult)Overloaded. (Defined by ILogExtensions.)
Public Extension MethodDebugExt(Object)Overloaded.
Log a message object with the Debug level.
(Defined by ILogExtensions.)
Public Extension MethodDebugExt(FuncTResult, Void)Overloaded. (Defined by ILogExtensions.)
Public Extension MethodDebugExt(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.)
Public Extension MethodDebugFormatExt(String, Object)Overloaded.
Logs a formatted message string with the Debug level.
(Defined by ILogExtensions.)
Public Extension MethodDebugFormatExt(String, Object)Overloaded.
Logs a formatted message string with the Debug level.
(Defined by ILogExtensions.)
Public Extension MethodDebugFormatExt(IFormatProvider, String, Object)Overloaded.
Logs a formatted message string with the Debug level.
(Defined by ILogExtensions.)
Public Extension MethodDebugFormatExt(String, Object, Object)Overloaded.
Logs a formatted message string with the Debug level.
(Defined by ILogExtensions.)
Public Extension MethodDebugFormatExt(String, Object, Object, Object)Overloaded.
Logs a formatted message string with the Debug level.
(Defined by ILogExtensions.)
Public Extension MethodErrorExt(FuncTResult)Overloaded. (Defined by ILogExtensions.)
Public Extension MethodErrorExt(Object)Overloaded.
Log a message object with the Error level.
(Defined by ILogExtensions.)
Public Extension MethodErrorExt(FuncTResult, Void)Overloaded. (Defined by ILogExtensions.)
Public Extension MethodErrorExt(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.)
Public Extension MethodErrorFormatExt(String, Object)Overloaded.
Logs a formatted message string with the Error level.
(Defined by ILogExtensions.)
Public Extension MethodErrorFormatExt(String, Object)Overloaded.
Logs a formatted message string with the Error level.
(Defined by ILogExtensions.)
Public Extension MethodErrorFormatExt(IFormatProvider, String, Object)Overloaded.
Logs a formatted message string with the Error level.
(Defined by ILogExtensions.)
Public Extension MethodErrorFormatExt(String, Object, Object)Overloaded.
Logs a formatted message string with the Error level.
(Defined by ILogExtensions.)
Public Extension MethodErrorFormatExt(String, Object, Object, Object)Overloaded.
Logs a formatted message string with the Error level.
(Defined by ILogExtensions.)
Public Extension MethodFatalExt(FuncTResult)Overloaded. (Defined by ILogExtensions.)
Public Extension MethodFatalExt(Object)Overloaded.
Log a message object with the Fatal level.
(Defined by ILogExtensions.)
Public Extension MethodFatalExt(FuncTResult, Void)Overloaded. (Defined by ILogExtensions.)
Public Extension MethodFatalExt(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.)
Public Extension MethodFatalFormatExt(String, Object)Overloaded.
Logs a formatted message string with the Fatal level.
(Defined by ILogExtensions.)
Public Extension MethodFatalFormatExt(String, Object)Overloaded.
Logs a formatted message string with the Fatal level.
(Defined by ILogExtensions.)
Public Extension MethodFatalFormatExt(IFormatProvider, String, Object)Overloaded.
Logs a formatted message string with the Fatal level.
(Defined by ILogExtensions.)
Public Extension MethodFatalFormatExt(String, Object, Object)Overloaded.
Logs a formatted message string with the Fatal level.
(Defined by ILogExtensions.)
Public Extension MethodFatalFormatExt(String, Object, Object, Object)Overloaded.
Logs a formatted message string with the Fatal level.
(Defined by ILogExtensions.)
Public Extension MethodInfoExt(FuncTResult)Overloaded. (Defined by ILogExtensions.)
Public Extension MethodInfoExt(Object)Overloaded.
Log a message object with the Info level.
(Defined by ILogExtensions.)
Public Extension MethodInfoExt(FuncTResult, Void)Overloaded. (Defined by ILogExtensions.)
Public Extension MethodInfoExt(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.)
Public Extension MethodInfoFormatExt(String, Object)Overloaded.
Logs a formatted message string with the Info level.
(Defined by ILogExtensions.)
Public Extension MethodInfoFormatExt(String, Object)Overloaded.
Logs a formatted message string with the Info level.
(Defined by ILogExtensions.)
Public Extension MethodInfoFormatExt(IFormatProvider, String, Object)Overloaded.
Logs a formatted message string with the Info level.
(Defined by ILogExtensions.)
Public Extension MethodInfoFormatExt(String, Object, Object)Overloaded.
Logs a formatted message string with the Info level.
(Defined by ILogExtensions.)
Public Extension MethodInfoFormatExt(String, Object, Object, Object)Overloaded.
Logs a formatted message string with the Info level.
(Defined by ILogExtensions.)
Public Extension MethodWarnExt(FuncTResult)Overloaded. (Defined by ILogExtensions.)
Public Extension MethodWarnExt(Object)Overloaded.
Log a message object with the Warn level.
(Defined by ILogExtensions.)
Public Extension MethodWarnExt(FuncTResult, Void)Overloaded. (Defined by ILogExtensions.)
Public Extension MethodWarnExt(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.)
Public Extension MethodWarnFormatExt(String, Object)Overloaded.
Logs a formatted message string with the Warn level.
(Defined by ILogExtensions.)
Public Extension MethodWarnFormatExt(String, Object)Overloaded.
Logs a formatted message string with the Warn level.
(Defined by ILogExtensions.)
Public Extension MethodWarnFormatExt(IFormatProvider, String, Object)Overloaded.
Logs a formatted message string with the Warn level.
(Defined by ILogExtensions.)
Public Extension MethodWarnFormatExt(String, Object, Object)Overloaded.
Logs a formatted message string with the Warn level.
(Defined by ILogExtensions.)
Public Extension MethodWarnFormatExt(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#
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

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