Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log4Net Levels Numeric Values

Tags:

log4net

I can't seem to find the numeric values for the predefined levels in Log4Net. Can anybody point me to them?

like image 434
Lieven Cardoen Avatar asked Jan 04 '10 11:01

Lieven Cardoen


People also ask

What is level value in log4net?

log4net offers the following log levels, in increasing order of priority: ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF. The ALL level logs everything and the OFF level logs nothing.

What are the main components of log4net?

Log4net has three main components: loggers, appenders and layouts. These three types of components work together to enable developers to log messages according to message type and level, and to control at runtime how these messages are formatted and where they are reported.

What is log4net config?

The log4net configuration can be configured using assembly-level attributes rather than specified programmatically. If specified, this is the filename of the configuration file to use with the XmlConfigurator. This file path is relative to the application base directory (AppDomain. CurrentDomain.


2 Answers

Here is an excerpt from the Level class (decompiled with .net reflector)

  public static readonly Level Alert = new Level(0x186a0, "ALERT");
    public static readonly Level All = new Level(-2147483648, "ALL");
    public static readonly Level Critical = new Level(0x15f90, "CRITICAL");
    public static readonly Level Debug = new Level(0x7530, "DEBUG");
    public static readonly Level Emergency = new Level(0x1d4c0, "EMERGENCY");
    public static readonly Level Error = new Level(0x11170, "ERROR");
    public static readonly Level Fatal = new Level(0x1adb0, "FATAL");
    public static readonly Level Fine = new Level(0x7530, "FINE");
    public static readonly Level Finer = new Level(0x4e20, "FINER");
    public static readonly Level Finest = new Level(0x2710, "FINEST");
    public static readonly Level Info = new Level(0x9c40, "INFO");
    private readonly string m_levelDisplayName;
    private readonly string m_levelName;
    private readonly int m_levelValue;
    public static readonly Level Notice = new Level(0xc350, "NOTICE");
    public static readonly Level Off = new Level(0x7fffffff, "OFF");
    public static readonly Level Severe = new Level(0x13880, "SEVERE");
    public static readonly Level Trace = new Level(0x4e20, "TRACE");
    public static readonly Level Verbose = new Level(0x2710, "VERBOSE");
    public static readonly Level Warn = new Level(0xea60, "WARN");
like image 33
dcp Avatar answered Oct 03 '22 17:10

dcp


The trunk code for Level.cs gives these numbers:

  • Off: int.MaxValue (2,147,483,647; 0x7FFFFFFF)
  • Emergency: 120000
  • Fatal: 110000
  • Alert: 100000
  • Critical: 90000
  • Severe: 80000
  • Error: 70000
  • Warn: 60000
  • Notice: 50000
  • Info: 40000
  • Debug: 30000
  • Fine: 30000
  • Trace: 20000
  • Finer: 20000
  • Verbose: 10000
  • Finest: 10000
  • All: int.MinValue (-2,147,483,648; 0x80000000)
like image 107
Jon Skeet Avatar answered Oct 03 '22 17:10

Jon Skeet