ElMehdi TAHRI created LOG4J2-1153:
-------------------------------------
Summary: Unable to define only rootLogger in a properties file.
Key: LOG4J2-1153
URL: https://issues.apache.org/jira/browse/LOG4J2-1153
Project: Log4j 2
Issue Type: Bug
Components: Configurators
Environment: Linux Ubuntu 14.04; Java 1.8; Log4j-2.4
Reporter: ElMehdi TAHRI
I've changed the version of log4j2 from 2.3 to 2.4 in order to load the
configuration via properties file. So i have converted the xml file, that
defines only <Root> in <Loggers> element, into a properties file.
This is a preview of the xml file :
{code:xml}
<Loggers>
<Root level="info">
<AppenderRef ref="ConsoleAppender"/>
</Root>
</Loggers>
{code}
And this is a preview of the properties file :
{code}
rootLogger.level = info
rootLogger.appenderRefs = console
rootLogger.appenderRef.console.ref = ConsoleAppender
{code}
This configuration throw a null pointer exception :
{noformat}Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
at
org.apache.logging.log4j.core.config.properties.PropertiesConfigurationFactory.getConfiguration(PropertiesConfigurationFactory.java:132)
at
org.apache.logging.log4j.core.config.properties.PropertiesConfigurationFactory.getConfiguration(PropertiesConfigurationFactory.java:44)
at
org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:491)
at
org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:461)
at
org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:257)
at
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:493)
at
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:510)
at
org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:199)
at
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:146)
at
org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:264)
at org.apache.log4j.Logger$PrivateManager.getContext(Logger.java:59)
at org.apache.log4j.Logger.getLogger(Logger.java:41)
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]