You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "ElMehdi TAHRI (JIRA)" <ji...@apache.org> on 2015/10/06 16:05:26 UTC
[jira] [Updated] (LOG4J2-1153) Unable to define only rootLogger in
a properties file.
[ https://issues.apache.org/jira/browse/LOG4J2-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ElMehdi TAHRI updated LOG4J2-1153:
----------------------------------
Affects Version/s: 2.4
> 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
> Affects Versions: 2.4
> Environment: Linux Ubuntu 14.04; Java 1.8; Log4j-2.4
> Reporter: ElMehdi TAHRI
> Labels: logger, nullpointerexception, properties, root, xml
>
> 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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org