I am using Logback and SLF4J in a tomcat based web application. I do not use the logback.xml file. Everything is done programmatically. However, from time to time I received the following error message:
java.lang.ClassCastException: org.slf4j.helpers.SubstituteLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext.
and this is the part of the code that throws this exception:
LoggerContext logCtx = (LoggerContext) LoggerFactory
.getILoggerFactory();
I would like to know that I am doing something wrong or not. Please, help.
source
share