I am checking out log4j2 via the overview documentation and I am getting the following exception when trying to setup the log4j2 logger:
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:129)
at HelloWorld.<clinit>(HelloWorld.java:5)
My test program is taken from the overview site:
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class HelloWorld {
private static Logger logger = LogManager.getLogger("HelloWorld");
public static void main(String[] args) {
logger.info("Hello, World!");
}
}
I added all the provided jar files from the binary distribution to my build path.
What am I missing?
Simply don’t! Use Logback instead of Log4J!