Skip to content

Commit 4bc7b55

Browse files
authored
#204 - java.lang.ClassCastException: class org.slf4j.helpers.SubstituteLoggerFactory cannot be cast to class ch.qos.logback.classic.LoggerContext (#205)
1 parent 8b25ee7 commit 4bc7b55

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

avaje-dynamic-logback/src/main/java/io/avaje/config/dynamiclogback/LogbackPlugin.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
@ServiceProvider
2121
public final class LogbackPlugin implements ConfigurationPlugin {
2222

23+
static {
24+
// see #204. Without this called statically, the same call in the constructor
25+
// may return SubstituteLoggerFactory and fail to cast.
26+
LoggerFactory.getILoggerFactory();
27+
}
28+
2329
private static final System.Logger log = AppLog.getLogger(LogbackPlugin.class);
2430

2531
@Override

0 commit comments

Comments
 (0)