Log4j Logging Levels

Log4j is provided with different logging levels:

DEBUG Level

It is useful for debugging application. It should not be used in production environment.

INFO Level

It can be used to display information messages in logs. It is one level higher than DEBUG.

WARN Level

It can be used to provide warning about an unexpected event.

ERROR Level

It is generally used in production environment and used to provide information about any kind of exception or error. It is one level higher than WARN.

FATAL Level

It can be used for condition which causes application to halt. We generally do not use this logger level.

ALL Level

It is used to turn on all levels of logging. Once this is configured and the levels are not considered.

OFF Level

It is opposite to ALL level. It turns off all the logging.

TRACE Level

It gives more detailed information than the DEBUG level and sits top of the hierarchy.

Table with log levels:

Log4J LevelsTraceDebugInfoWarnErrorFatal
TRACE Level Y Y Y Y Y Y
DEBUG Level N Y Y Y Y Y
INFO Level N N Y Y Y Y
WARN Level N N N Y Y Y
ERROR Level N N N N Y Y
FATAL Level N N N N N Y
ALL Level Y Y Y Y Y Y
OFF Level N N N N N N