Reputation: 33
We have log4j2 implementation (2.0-beta9) and also using slf4j.version 1.7.3. I am initializing the logger like
private transient final Logger logger = LogManager.getLogger(this.getClass());
Whenever there is any error I am printing errors like
logger.error("Error message is : " + e); ---> This line is throwing error like
Error:
java.lang.ClassCastException: org.slf4j.helpers.NOPLogger cannot be cast to org.slf4j.spi.LocationAwareLogger
How do I fix this issue?
Upvotes: 0
Views: 8112
Reputation: 36784
Also, beta9 is very old. Please upgrade to rc2 when you have a chance.
Upvotes: 0
Reputation: 75386
You most likely have multiple slf4j jars in your complete configuration, and classes defined by one classloader cannot be cast to classes or interfaces defined in another classloader.
Upvotes: 3