You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Dennys Fredericci <de...@fredericci.com.br> on 2020/08/30 20:49:03 UTC
NPE on reconfigure call with async configuration
Hi, all
I am getting the error below trying to reconfigure log4j programmatically.
2020-08-24 10:10:18,163 main ERROR Could not register mbeans
java.lang.NullPointerException
at
org.apache.logging.log4j.core.async.AsyncLoggerConfigDisruptor.createRingBufferAdmin(AsyncLoggerConfigDisruptor.java:417)
at
org.apache.logging.log4j.core.async.AsyncLoggerConfig.createRingBufferAdmin(AsyncLoggerConfig.java:199)
at
org.apache.logging.log4j.core.jmx.Server.registerLoggerConfigs(Server.java:366)
at
org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:186)
at
org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:141)
at
org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:629)
at
org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:712)
at
org.apache.logging.log4j.core.config.Configurator.reconfigure(Configurator.java:239)
at br.com.fredericci.Main.main(Main.java:28)
Seems the same or similar problem described here:
https://issues.apache.org/jira/browse/LOG4J2-807
Here is the project which reproduces this issue:
https://github.com/dennysfredericci/log4j2-filter-spike
If I replace the Configurator.reconfigure(config); call to config.stop();
config.start(); everything works fine, but i am not sure if this is the
right way to "reconfigure" log4j.
What I am doing to reconfigure is correct? Is it a bug on log4j? Or am I
doing something wrong?
Regards,
Dennys Fredericci