Log4j 2. How get log4j's debug messages?

Kirill Popov picture Kirill Popov · Oct 24, 2013 · Viewed 16.6k times · Source

As far as i understand log4j can handle system property -Dlog4j.debug. If you run your app with it you will get log4j's debug output.

Example: java -Dlog4j.debug -jar test.jar

Is there something similar for log4j 2?

Answer

Remko Popma picture Remko Popma · Feb 19, 2015

Update January 2018:

From Log4j 2.10, this is easy: just run your program with system property log4j2.debug (no value needed; an empty string is fine).


The current (log4j-2.1) documentation on the status logger is a bit confusing. Basically:

  • Until a configuration is found, status logger level can be controlled with system property org.apache.logging.log4j.simplelog.StatusLogger.level.
  • After a configuration is found, status logger level can be controlled in the configuration file with the "status" attribute, for example: <Configuration status="trace">.

UPDATE: the documentation was improved in log4j-2.2.