[slf4j-user] can't understand cast error

Joachim Durchholz jo at durchholz.org
Sun Aug 2 21:32:51 CEST 2015


Am 02.08.2015 um 19:40 schrieb pedro rijo:
>   As I said before, I've created a repository with a working example
> (working, meaning with the error happening) here:
> https://bitbucket.org/pedrorijo91/logger-exp

I don't know why it's throwing an error with two tests but working with 
just one, but the type cast is definitely wrong - you're trying to force 
it into a ch.qos.logback.classic.Logger, but LoggerFactory will give you 
an org.slf4j.Logger.
You work with ch.qos.logback.classic.Logger when implementing a logger, 
an appender or anything else in the logging machinery, or possibly 
during logging setup, but not when sending log messages. Code that 
merely creates log messages should work with org.slf4j.Logger.


More information about the slf4j-user mailing list