Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log4j Dependencies not being passed to the Benchmark #213

Open
pavibhai opened this issue Mar 10, 2022 · 0 comments
Open

Log4j Dependencies not being passed to the Benchmark #213

pavibhai opened this issue Mar 10, 2022 · 0 comments

Comments

@pavibhai
Copy link

pavibhai commented Mar 10, 2022

I have a project that creates a new log4j2 appender and has log4j dependencies called out in the project

"org.apache.logging.log4j" % "log4j-core" % "2.17.1"
"org.apache.logging.log4j" % "log4j-api" % "2.17.1"
"org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.17.1"
"org.apache.logging.log4j" % "log4j-1.2-api" % "2.17.1"

When I run the benchmarks, I get the following failure

AverageTime(RandomLogBench_perform_jmhTest.java:162)
[info] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[info] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[info] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[info] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[info] 	at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:470)
[info] 	at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:453)
[info] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[info] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[info] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[info] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128
[info] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628
[info] 	at java.base/java.lang.Thread.run(Thread.java:829)
[info] Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager
[info] 	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
[info] 	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
[info] 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
[info] 	... 15 more

The module does compile and test successfully using the same classes, only the jmh:run sees this failure.

I further explored the class path values

show bench/Jmh/dependencyClasspath
...
[info] * Attributed([snip]/.ivy2/cache/org.apache.logging.log4j/log4j-api/jars/log4j-api-2.17.1.jar)
[info] * Attributed([snip]/.ivy2/cache/org.apache.logging.log4j/log4j-slf4j-impl/jars/log4j-slf4j-impl-2.17.1.jar)
[info] * Attributed([snip]/.ivy2/cache/org.apache.logging.log4j/log4j-1.2-api/jars/log4j-1.2-api-2.17.1.jar)
...
[info] * Attributed([snip]/.ivy2/cache/org.apache.logging.log4j/log4j-core/jars/log4j-core-2.17.1.jar)
...

I tried outputting the classpath from an empty bench and there I don't see the log4j jars in the class path, but I see all other dependencies.

Do I need to do anything special to propagate the log4j libraries to the benchmarks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant