ILogExtensions ErrorExt Method (ILog, Object) | Apache log4net™ SDK Documentation

Log a message object with the Error level.

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

C#
VB
C++
F#
Copy

    public static void ErrorExt(
    	this ILog logger,
    	Object message
    )

    <ExtensionAttribute>
    Public Shared Sub ErrorExt (
    	logger As ILog,
    	message As Object
    )

    public:
    [ExtensionAttribute]
    static void ErrorExt(
    	ILog^ logger,
    	Object^ message
    )

    [<ExtensionAttribute>]
    static member ErrorExt :
            logger : ILog *
            message : Object -> unit

#### Parameters

logger
  Type: log4net
  ILog
  The logger on which the message is logged.
message
  Type: System
  Object
  The message object to log.

#### Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ILog. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

This method first checks if this logger is ERROR enabled by reading the value property. This check happens always and does not depend on the implementation. If this logger is ERROR enabled, then it converts the message object (passed as parameter) to a string by invoking the appropriate IObjectRenderer. It then proceeds to call all the registered appenders in this logger and also higher in the hierarchy depending on the value of the additivity flag.

WARNING Note that passing an Exception to this method will print the name of the Exception but no stack trace. To print a stack trace use the ErrorExt(ILog, Object, Exception) form instead.

See Also

#### Reference

ILogExtensions Class
ErrorExt Overload
log4net.Util Namespace
ILog
IsErrorEnabled
log4net
ILog
ILog
Error(Object)
ILog
IsErrorEnabled