Java Utililty Methods slf4j Logger

List of utility methods to do slf4j Logger

Description

The list of methods to do slf4j Logger are organized into topic(s).

Method

voidlogInfo(Logger log)
Writes the logo to the given Logger, using the Info log level.
for (String line : lines) {
    log.info(line);
voidlogInfo(Logger log, Throwable t)
log Info
log.info(t.getMessage());
if (log.isDebugEnabled())
    log.info(t.getMessage(), t);
voidlogInfo(Logger logger, String s)
log Info
logger.info("[INFO] " + s);
voidlogJavaProperties(Logger log)
log Java Properties
Properties javaProperties = System.getProperties();
SortedMap<String, String> sortedProperties = new TreeMap<String, String>();
for (String key : javaProperties.stringPropertyNames()) {
    sortedProperties.put(key, javaProperties.getProperty(key));
log.debug("Java properties (ordered by property name):"); 
for (String key : sortedProperties.keySet()) {
    log.debug("   {}={}", key, sortedProperties.get(key));
...
voidlogLine(final Logger logger, final Level level, final String msg, final boolean withStackTrace, final String logMessagePrefix)
Directly log msg to desired Logger .
final String finalMsg = logMessagePrefix + msg;
if (level == Level.INFO) {
    if (withStackTrace) {
        logger.info(finalMsg, new Throwable());
    } else {
        logger.info(finalMsg);
} else if (level == Level.SEVERE) {
...
voidlogResult(long time, String traceId, String apiName, String params, String jsonObject)
log Result
if (REUEST_LOGGER.isDebugEnabled()) {
    REUEST_LOGGER.debug(LOG_TRACE_MSG_WITH_PARAMS_DEBUG,
            new Object[] { time, traceId, apiName, params, jsonObject });
} else if (REUEST_LOGGER.isInfoEnabled()) {
    REUEST_LOGGER.info(LOG_TRACE_MSG_WITH_PARAMS_INFO, new Object[] { time, traceId, apiName });
voidlogThreadGroup(final Logger log, ThreadGroup group, int level)
This method recursively visits (LOG.info()) all thread groups under `group'.
int numThreads = group.activeCount();
final Thread[] threads = new Thread[numThreads * 2];
numThreads = group.enumerate(threads, false);
for (int i = 0; i < numThreads; i++) {
    final Thread thread = threads[i];
    log.info(thread.toString());
int numGroups = group.activeGroupCount();
...
voidlogThrowable(Throwable throwable)
log Throwable
logger.error("An exception occured:" + throwable.getMessage(), throwable);
voidlogWarningWithDebugDetails(Logger logger, Throwable t, String message, Object... values)
Log a warning message with the corresponding throwable being logged at debug level.
logger.warn(String.format("%s (details at debug level)", message), values);
logger.debug("Stacktrace of the preceding warning", t);
voidnotNull(String message, Object obj)
not Null
if (obj == null) {
    throw new NullPointerException(message);