Level Class | Apache log4net™ SDK Documentation

Defines the default set of levels recognized by the system.
Inheritance Hierarchy

System
Object
log4net.Core
Level

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

C#
VB
C++
F#
Copy

    [SerializableAttribute]
    public sealed class Level : IComparable

    <SerializableAttribute>
    Public NotInheritable Class Level
    	Implements IComparable

    [SerializableAttribute]
    public ref class Level sealed : IComparable

    [<SealedAttribute>]
    [<SerializableAttribute>]
    type Level =
        class
            interface IComparable
        end

The Level type exposes the following members.

Constructors

| Name | Description
--- | --- | ---
| Level(Int32, String) | Constructor
| Level(Int32, String, String) | Constructor

Top
Properties

| Name | Description
--- | --- | ---
| DisplayName | Gets the display name of this level.
| Name | Gets the name of this level.
| Value | Gets the value of this level.

Top
Methods

| Name | Description
--- | --- | ---
| Compare | Compares two specified Level instances.
| CompareTo | Compares this instance to a specified object and returns an indication of their relative values.
| Equals | Compares levels. (Overrides Object Equals(Object).)
| GetHashCode | Returns a hash code (Overrides Object GetHashCode .)
| GetType | Gets the Type of the current instance. (Inherited from Object.)
| ToString | Returns the String representation of the current Level. (Overrides Object ToString .)

Top
Operators

| Name | Description
--- | --- | ---
| Equality | Returns a value indicating whether two specified Level objects have the same value.
| GreaterThan | Returns a value indicating whether a specified Level is greater than another specified Level.
| GreaterThanOrEqual | Returns a value indicating whether a specified Level is greater than or equal to another specified Level.
| Inequality | Returns a value indicating whether two specified Level objects have different values.
| LessThan | Returns a value indicating whether a specified Level is less than another specified Level.
| LessThanOrEqual | Returns a value indicating whether a specified Level is less than or equal to another specified Level.

Top
Fields

| Name | Description
--- | --- | ---
| Alert | The Alert level designates very severe error events. Take immediate action, alerts.
| All | The All level designates the lowest level possible.
| Critical | The Critical level designates very severe error events. Critical condition, critical.
| Debug | The Debug level designates fine-grained informational events that are most useful to debug an application.
| Emergency | The Emergency level designates very severe error events. System unusable, emergencies.
| Error | The Error level designates error events that might still allow the application to continue running.
| Fatal | The Fatal level designates very severe error events that will presumably lead the application to abort.
| Fine | The Fine level designates fine-grained informational events that are most useful to debug an application.
| Finer | The Finer level designates fine-grained informational events that are most useful to debug an application.
| Finest | The Finest level designates fine-grained informational events that are most useful to debug an application.
| Info | The Info level designates informational messages that highlight the progress of the application at coarse-grained level.
| Log4Net_Debug | The Emergency level designates very severe error events. System unusable, emergencies.
| Notice | The Notice level designates informational messages that highlight the progress of the application at the highest level.
| Off | The Off level designates a higher level than all the rest.
| Severe | The Severe level designates very severe error events.
| Trace | The Trace level designates fine-grained informational events that are most useful to debug an application.
| Verbose | The Verbose level designates fine-grained informational events that are most useful to debug an application.
| Warn | The Warn level designates potentially harmful situations.

Top
Remarks

Each LoggingEvent has an associated Level.

Levels have a numeric Value that defines the relative ordering between levels. Two Levels with the same Value are deemed to be equivalent.

The levels that are recognized by log4net are set for each ILoggerRepository and each repository can have different levels defined. The levels are stored in the LevelMap on the repository. Levels are looked up by name from the LevelMap.

When logging at level INFO the actual level used is not Info but the value of LoggerRepository.LevelMap["INFO"]. The default value for this is Info, but this can be changed by reconfiguring the level map.

Each level has a DisplayName in addition to its Name. The DisplayName is the string that is written into the output log. By default the display name is the same as the level name, but this can be used to alias levels or to localize the log output.

Some of the predefined levels recognized by the system are:

- Off.
- Fatal.
- Error.
- Warn.
- Info.
- Debug.
- All.

See Also

#### Reference

log4net.Core Namespace