Levels in Log4j

Loggers may be assigned levels. The set of possible levels, that is DEBUG, INFO, WARN, ERROR and FATAL are defined in the org.apache.log4j.Level class.

If a given logger is not assigned a level, then it inherits one from its closest ancestor with an assigned level.

The root logger resides at the top of the logger hierarchy. It always exists and always has an assigned level.

The logger is the core component of the logging process. In log4j, there are 5 normal levels Levels of logger available (not including custom Levels), the following is borrowed from the log4j API (http://jakarta.apache.org/log4j/docs/api/index.html):
static Level DEBUG - The DEBUG Level designates fine-grained informational events that are most useful to debug an application.
static Level INFO - The INFO level designates informational messages that highlight the progress of the application at coarse-grained level.
static Level WARN - The WARN level designates potentially harmful situations.
static Level ERROR - The ERROR level designates error events that might still allow the application to continue running.
static Level FATAL - The FATAL level designates very severe error events that will presumably lead the application to abort.

In addition, there are two special levels of logging available: (descriptions borrowed from the log4j API http://jakarta.apache.org/log4j/docs/api/index.html):

static Level ALL -The ALL Level has the lowest possible rank and is intended to turn on all logging.
static Level OFF - The OFF Level has the highest possible rank and is intended to turn off logging.

0 comments: