What are log4j logging hierarchical order in Java?

log4j is the Java logging API. It allows Java developers to log application states. Very often we get confused about different logging levels on Java project. Often developers says why the debug message is not showing up. It could be the logging level is set to info like in we do in spring boot application:

logging.level.root=info

Following is the hierarchical order of different logging levels:

# FATAL ERROR WARN INFO DEBUG TRACE ALL
OFF
FATAL
ERROR
WARN
INFO
DEBUG
TRACE
ALL

If we check the code of log4j API’s level class we can also get a clean idea about it:

public final static int OFF_INT = Integer.MAX_VALUE;
public final static int FATAL_INT = 50000;
public final static int ERROR_INT = 40000;
public final static int WARN_INT  = 30000;
public final static int INFO_INT  = 20000;
public final static int DEBUG_INT = 10000;
public static final int TRACE_INT = 5000; 
public final static int ALL_INT = Integer.MIN_VALUE; 
Share