LogManager Class | Apache log4net™ SDK Documentation

This class is used by client applications to request logger instances.
Inheritance Hierarchy

System
Object
log4net
LogManager

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

C#
VB
C++
F#
Copy

    public sealed class LogManager

    Public NotInheritable Class LogManager

    public ref class LogManager sealed

    [<SealedAttribute>]
    type LogManager =  class end

The LogManager type exposes the following members.

Methods

| Name | Description
--- | --- | ---
| CreateDomain(String) | Obsolete. Creates a repository with the specified name.
| CreateDomain(Type) | Obsolete. Creates a repository with the specified repository type.
| CreateDomain(Assembly, Type) | Obsolete. Creates a repository for the specified assembly and repository type.
| CreateDomain(String, Type) | Obsolete. Creates a repository with the specified name and repository type.
| CreateRepository(String) | Creates a repository with the specified name.
| CreateRepository(Type) | Creates a repository with the specified repository type.
| CreateRepository(Assembly, Type) | Creates a repository for the specified assembly and repository type.
| CreateRepository(String, Type) | Creates a repository with the specified name and repository type.
| Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
| Exists(String) | Returns the named logger if it exists.
| Exists(Assembly, String) | Returns the named logger if it exists.
| Exists(String, String) | Returns the named logger if it exists.
| Flush | Flushes logging events buffered in all configured appenders in the default repository.
| GetAllRepositories | Gets the list of currently defined repositories.
| GetCurrentLoggers | Returns all the currently defined loggers in the default repository.
| GetCurrentLoggers(Assembly) | Returns all the currently defined loggers in the specified assembly's repository.
| GetCurrentLoggers(String) | Returns all the currently defined loggers in the specified repository.
| GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.)
| GetLogger(String) | Retrieves or creates a named logger.
| GetLogger(Type) | Shorthand for GetLogger(string).
| GetLogger(Assembly, String) | Retrieves or creates a named logger.
| GetLogger(Assembly, Type) | Shorthand for GetLogger(string).
| GetLogger(String, String) | Retrieves or creates a named logger.
| GetLogger(String, Type) | Shorthand for GetLogger(string).
| GetLoggerRepository | Obsolete. Returns the default ILoggerRepository instance.
| GetLoggerRepository(Assembly) | Obsolete. Returns the default ILoggerRepository instance.
| GetLoggerRepository(String) | Obsolete. Returns the default ILoggerRepository instance.
| GetRepository | Returns the default ILoggerRepository instance.
| GetRepository(Assembly) | Returns the default ILoggerRepository instance.
| GetRepository(String) | Returns the default ILoggerRepository instance.
| GetType | Gets the Type of the current instance. (Inherited from Object.)
| ResetConfiguration | Resets all values contained in this repository instance to their defaults.
| ResetConfiguration(Assembly) | Resets all values contained in this repository instance to their defaults.
| ResetConfiguration(String) | Resets all values contained in this repository instance to their defaults.
| Shutdown | Shuts down the log4net system.
| ShutdownRepository | Shuts down the default repository.
| ShutdownRepository(Assembly) | Shuts down the repository specified.
| ShutdownRepository(String) | Shuts down the repository for the repository specified.
| ToString | Returns a String that represents the current Object. (Inherited from Object.)

Top
Remarks

This class has static methods that are used by a client to request a logger instance. The [M:GetLogger(string)] method is used to retrieve a logger.

See the ILog interface for more details.

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");
    }

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.
See Also

#### Reference

log4net Namespace
log4net
ILog