logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Wiedmann <jochen.wiedm...@gmail.com>
Subject Re: Programmatic configuration => NPE
Date Fri, 10 Jun 2016 07:30:51 GMT
On Thu, Jun 9, 2016 at 2:45 PM, Remko Popma <remko.popma@gmail.com> wrote:
> Do you have a stacktrace?

Silly me. Of course, I have:

Exception in thread "main" java.lang.NullPointerException: No
Configuration was provided
at java.util.Objects.requireNonNull(Objects.java:228)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:477)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:561)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:577)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:212)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551)
at demo.log4j.Main.main(Main.java:11)

And here's the source code again, if you'd like to reproduce:


    public static void main(String[] pArgs) {
        ConfigurationFactory.setConfigurationFactory(new
MyConfigurationFactory());
        final Logger log = LogManager.getLogger(Main.class);
        log.info("Starting");
    }



-- 
The next time you hear: "Don't reinvent the wheel!"

http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message