Hi All,

I am using Eclipse as my IDE and when I run
org.apache.logging.log4j.core.BasicLoggingTest I get an NPE because
org.apache.logging.log4j.LogManager.factory is null. It is null because
when the static initializer runs it picks up 2 factories instead of one:

[org.apache.logging.log4j.core.impl.Log4jContextFactory@39c8c1,
org.apache.logging.log4j.SimpleLoggerContextFactory@1ab2b55].

Can we be more lenient?

Instead of:

            if (factories.size() != 1) {
                logger.fatal("Unable to locate a logging implementation");
            } else {
                factory = factories.get(0);
            }

How about:

            if (factories.size() != 1) {
                logger.error("Expected a single logging implementation, not
{}, picking the first: {}", factories.size(), factories.get(0));
            }
            factory = factories.get(0);

?

-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to