package org.apache.cassandra.utils.logging;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.utils.FBUtilities;
public class LoggingSupportFactory
{
private static final Logger logger = LoggerFactory.getLogger(LoggingSupportFactory.class);
private static volatile LoggingSupport loggingSupport;
private LoggingSupportFactory() {}
public static LoggingSupport getLoggingSupport()
{
if (loggingSupport == null)
{
String loggerFactoryClass = LoggerFactory.getILoggerFactory().getClass().getName();
if (loggerFactoryClass.contains("logback"))
{
loggingSupport = FBUtilities.instanceOrConstruct("org.apache.cassandra.utils.logging.LogbackLoggingSupport", "LogbackLoggingSupport");
}
else
{
loggingSupport = new NoOpFallbackLoggingSupport();
logger.warn("You are using Cassandra with an unsupported deployment. The intended logging implementation library logback is not used by slf4j. Detected slf4j logger factory: {}. "
+ "You will not be able to dynamically manage log levels via JMX and may have performance or other issues.", loggerFactoryClass);
}
}
return loggingSupport;
}
}