3 ms·
java.util.logging was braindead because it wanted to know the class and method doing the logging. If not provided, it threw and catched an exception and filter
by hyperman1 4y ago
java.util.logging was braindead because it wanted to know the class and method doing the logging. If not provided, it threw and catched an exception and filtered the stack trace to detect its own caller. Throwing an exception was a very slow operation.
I see they did some optimizations to do this work lazily if needed. But when log4j 1 was on its peak, that wasn't done, and using the built in logger was slow enough to have measurable impact .
See https://github.com/openjdk/jdk/blob/6765f902505fbdd02f25b599f942437cd805cad1/src/java.logging/share/classes/java/util/logging/LogRecord.java https://github.com/openjdk/jdk/blob/6765f902505fbdd02f25b599... at the bottom.