Log4j2 async logging using disruptor 3.x

Hi,
I’m trying to implement log4j2 async logging by using async loggers and disruptor.
I placed disruptor jar file under package/code/jars. But its not able to find it when I run my java service and throws below error. Can anyone please suggest.
INFO | jvm 1 | 2020/09/25 00:18:32 | 2020-09-25 00:18:32,449 Log4j2-TF-27-ConfiguratonFileWatcher-13 ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.async.AsyncLoggerConfig for element AsyncLogger: java.lang.NoClassDefFoundError: com/lmax/disruptor/EventFactory java.lang.reflect.InvocationTargetException
INFO | jvm 1 | 2020/09/25 00:18:32 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2020/09/25 00:18:32 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO | jvm 1 | 2020/09/25 00:18:32 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | 2020/09/25 00:18:32 | at java.lang.reflect.Method.invoke(Method.java:498)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:136)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:964)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:904)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:896)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:514)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:238)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:250)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:548)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.LoggerContext.onChange(LoggerContext.java:672)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.ConfiguratonFileWatcher$ReconfigurationRunnable.run(ConfiguratonFileWatcher.java:68)
INFO | jvm 1 | 2020/09/25 00:18:32 | at java.lang.Thread.run(Thread.java:748)
INFO | jvm 1 | 2020/09/25 00:18:32 | Caused by: java.lang.NoClassDefFoundError: com/lmax/disruptor/EventFactory
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.config.AbstractConfiguration.getAsyncLoggerConfigDelegate(AbstractConfiguration.java:203)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.async.AsyncLoggerConfig.(AsyncLoggerConfig.java:91)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.apache.logging.log4j.core.async.AsyncLoggerConfig.createLogger(AsyncLoggerConfig.java:273)
INFO | jvm 1 | 2020/09/25 00:18:32 | … 15 more
INFO | jvm 1 | 2020/09/25 00:18:32 | Caused by: java.lang.ClassNotFoundException: com.lmax.disruptor.EventFactory cannot be found by org.apache.logging.log4j.core_2.11.2
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:511)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:414)
INFO | jvm 1 | 2020/09/25 00:18:32 | at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:153)
INFO | jvm 1 | 2020/09/25 00:18:32 | at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
INFO | jvm 1 | 2020/09/25 00:18:32 | … 18 more
INFO | jvm 1 | 2020/09/25 00:18:32 |

Hi Manasa,

was the package reloaded after placing the jar?

Stopping and restarting the IS should do the trick, too.

Regards,
Holger

Thank you for the reply.Yes I have reloaded and restarted the server also. But not sure why is it unable to find the jars.
Other than adding them under code/jars. I also added them in Build path.

Hi Manasa,

can you share some more details about your config, please?
Is this also reported in the server.log of the IS or only in wrapper.log?

Eventually you will have to update your osgi bundle config to add the new jars/bundles there.

Regards,
Holger

Hi Holger,

Attached is the log4j config file I’m using.
A bit of Java code as follows:
Logger logger = LogManager.getLogger(“com.apple.b2b.appleIDLLog4j2.logging”);
logger.info(“write anything”);

It’s reported only in wrapper.log.log4j2.xml (1.3 KB)