What does “status” mean in Log4j2 configuration?

JavaLoggingConfigurationLog4jLog4j2

Java Problem Overview


I just have finished adjustment of log4j2.xml configuration file and spotted something I don't really understand. So what is <Configuration status="SOME_STATUS_HERE">?

Almost in all examples here : http://logging.apache.org/log4j/2.x/manual/configuration.html folks from Apache added status to configuration.

For example here is the first one:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN"> <!--status="WARN" - what is this???--> 
 
 <Appenders>
  <Console name="Console" target="SYSTEM_OUT">
   <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
  </Console>
 </Appenders>

 <Loggers>
  <Root level="error">
   <AppenderRef ref="Console"/>
  </Root>
 </Loggers>

</Configuration>

Java Solutions


Solution 1 - Java

The status logger is used internally by log4j2 components. Setting status="debug" (or "trace") in the configuration will cause this internal logging to be output to the command line.

It will print debug information about which log4j2 plugin components are loaded (all configuration elements map to log4j2 plugins), and more details like for example what appenders and loggers were found, what parameters they have and how they are combined.

This is useful for troubleshooting configuration issues.

From Log4j 2.9, you can use system property log4j2.debug (no value required) to turn on internal Log4j2 status logging even before the configuration file is loaded. Prior to version 2.9, the same can be achieved with system property -Dorg.apache.logging.log4j.simplelog.StatusLogger.level=TRACE.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionYurii BondarenkoView Question on Stackoverflow
Solution 1 - JavaRemko PopmaView Answer on Stackoverflow