LogManager Class
LogManager ClassApache log4net™ SDK Documentation
This class is used by client applications to request logger instances.
Inheritance Hierarchy

SystemObject
  log4netLogManager

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

public sealed class LogManager

The LogManager type exposes the following members.

Methods

  NameDescription
Public methodStatic memberCreateDomain(String) Obsolete.
Creates a repository with the specified name.
Public methodStatic memberCreateDomain(Type) Obsolete.
Creates a repository with the specified repository type.
Public methodStatic memberCreateDomain(Assembly, Type) Obsolete.
Creates a repository for the specified assembly and repository type.
Public methodStatic memberCreateDomain(String, Type) Obsolete.
Creates a repository with the specified name and repository type.
Public methodStatic memberCreateRepository(String)
Creates a repository with the specified name.
Public methodStatic memberCreateRepository(Type)
Creates a repository with the specified repository type.
Public methodStatic memberCreateRepository(Assembly, Type)
Creates a repository for the specified assembly and repository type.
Public methodStatic memberCreateRepository(String, Type)
Creates a repository with the specified name and repository type.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodStatic memberExists(String)
Returns the named logger if it exists.
Public methodStatic memberExists(Assembly, String)
Returns the named logger if it exists.
Public methodStatic memberExists(String, String)
Returns the named logger if it exists.
Public methodStatic memberFlush
Flushes logging events buffered in all configured appenders in the default repository.
Public methodStatic memberGetAllRepositories
Gets the list of currently defined repositories.
Public methodStatic memberGetCurrentLoggers
Returns all the currently defined loggers in the default repository.
Public methodStatic memberGetCurrentLoggers(Assembly)
Returns all the currently defined loggers in the specified assembly's repository.
Public methodStatic memberGetCurrentLoggers(String)
Returns all the currently defined loggers in the specified repository.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodStatic memberGetLogger(String)
Retrieves or creates a named logger.
Public methodStatic memberGetLogger(Type)
Shorthand for GetLogger(string).
Public methodStatic memberGetLogger(Assembly, String)
Retrieves or creates a named logger.
Public methodStatic memberGetLogger(Assembly, Type)
Shorthand for GetLogger(string).
Public methodStatic memberGetLogger(String, String)
Retrieves or creates a named logger.
Public methodStatic memberGetLogger(String, Type)
Shorthand for GetLogger(string).
Public methodStatic memberGetLoggerRepository Obsolete.
Returns the default ILoggerRepository instance.
Public methodStatic memberGetLoggerRepository(Assembly) Obsolete.
Returns the default ILoggerRepository instance.
Public methodStatic memberGetLoggerRepository(String) Obsolete.
Returns the default ILoggerRepository instance.
Public methodStatic memberGetRepository
Returns the default ILoggerRepository instance.
Public methodStatic memberGetRepository(Assembly)
Returns the default ILoggerRepository instance.
Public methodStatic memberGetRepository(String)
Returns the default ILoggerRepository instance.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberResetConfiguration
Resets all values contained in this repository instance to their defaults.
Public methodStatic memberResetConfiguration(Assembly)
Resets all values contained in this repository instance to their defaults.
Public methodStatic memberResetConfiguration(String)
Resets all values contained in this repository instance to their defaults.
Public methodStatic memberShutdown
Shuts down the log4net system.
Public methodStatic memberShutdownRepository
Shuts down the default repository.
Public methodStatic memberShutdownRepository(Assembly)
Shuts down the repository specified.
Public methodStatic memberShutdownRepository(String)
Shuts down the repository for the repository specified.
Public methodToString
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#
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