Class RootLogger
- Namespace
- log4net.Repository.Hierarchy
- Assembly
- log4net.dll
The RootLogger sits at the root of the logger hierarchy tree.
public class RootLogger : Logger, IAppenderAttachable, ILogger
- Inheritance
-
RootLogger
- Implements
- Inherited Members
Remarks
The RootLogger is a regular Logger except that it provides several guarantees.
First, it cannot be assigned a null
level. Second, since the root logger cannot have a parent, the
EffectiveLevel property always returns the value of the
level field without walking the hierarchy.
Constructors
RootLogger(Level)
Construct a RootLogger
public RootLogger(Level level)
Parameters
levelLevelThe level to assign to the root logger.
Remarks
Initializes a new instance of the RootLogger class with the specified logging level.
The root logger names itself as "root". However, the root logger cannot be retrieved by name.
Properties
EffectiveLevel
Gets the assigned level value without walking the logger hierarchy.
public override Level EffectiveLevel { get; }
Property Value
- Level
The assigned level value without walking the logger hierarchy.
Remarks
Because the root logger cannot have a parent and its level
must not be null this property just returns the
value of Level.
Level
Gets or sets the assigned Level for the root logger.
public override Level Level { get; set; }
Property Value
Remarks
Setting the level of the root logger to a null reference
may have catastrophic results. We prevent this here.