Skip to content

Commit 1edc1c7

Browse files
authored
Add ClassCastException to lmax-4 failure
During startup with an agent, the resulting object can be in the wrong classloader leading to a ClassCastException. Catching that falls back to the old behaviour which works fine The new behaviour was introduced in 2.23.0 with apache#2112
1 parent 29445d1 commit 1edc1c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private static EventHandler<RingBufferLogEvent> createEventHandler() {
5555
if (DisruptorUtil.DISRUPTOR_MAJOR_VERSION == 3) {
5656
try {
5757
return LoaderUtil.newInstanceOf("org.apache.logging.log4j.core.async.RingBufferLogEventHandler");
58-
} catch (final ReflectiveOperationException | LinkageError e) {
58+
} catch (final ClassCastException | ReflectiveOperationException | LinkageError e) {
5959
LOGGER.warn("Failed to create event handler for LMAX Disruptor 3.x, trying version 4.x.", e);
6060
}
6161
}

0 commit comments

Comments
 (0)