List of utility methods to do slf4j Logger
Logger | getLogger(String className) get Logger return LoggerFactory.getLogger(className);
|
Logger | getLoggerForCurrentClass() Create a slf4j logger based on the caller's class name. Thread currThread = Thread.currentThread();
StackTraceElement[] trace = currThread.getStackTrace();
return LoggerFactory.getLogger(trace[2].getClassName());
|
Logger | getLoggerInstance(String callerCLass) Returns a new Logger instance for given class name. If logger instance already exist in cache returns existing one if (LOGGER_INSTANCES.containsKey(callerCLass)) { return LOGGER_INSTANCES.get(callerCLass); Logger logger = LoggerFactory.getLogger(callerCLass); isTraceEnabled = logger.isTraceEnabled(); isDebugEnabled = logger.isDebugEnabled(); isInfoEnabled = logger.isInfoEnabled(); isWarnEnabled = logger.isWarnEnabled(); ... |
int | getLoggerLevel(Logger logger) get Logger Level if (logger == null) { throw new NullPointerException("logger must not be null"); if (logger.isTraceEnabled()) { return TRACE_LEVEL; if (logger.isDebugEnabled()) { return DEBUG_LEVEL; ... |
long | getLong(Properties config, String key, long defaultValue) Get long from properties. String val = config.getProperty(key); if (val == null) { return defaultValue; } else { try { return Long.parseLong(val); } catch (NumberFormatException nfe) { throw new IllegalArgumentException( ... |
String | getMessage(String message, Object... args) get Message return MessageFormatter.arrayFormat(message, args).getMessage();
|
int | getTraceLevel(Logger logger) get Trace Level if (logger.isDebugEnabled()) { return TRACE_DEBUG; } else if (logger.isInfoEnabled()) { return TRACE_INFO; } else if (logger.isWarnEnabled()) { return TRACE_WARN; } else { return TRACE_ERROR; ... |
void | ic static void i(String fmt, Object... args) i i(logger, fmt, args); |
void | info(Class> clz, String logStr) Log a message at the INFO level. LoggerFactory.getLogger(clz).info("[" + clz.getSimpleName() + "] " + logStr); |
void | info(final Logger log, final String message, final Object... args) info log.info(getFormattedMessage(message, args)); |