List of utility methods to do slf4j Logger
void | sleepMs(Logger logger, long timeMs) Sleeps for the given number of milliseconds, reporting interruptions using the given logger. sleepMs(logger, timeMs, false); |
void | stacktrace(Logger log, Throwable t) Print the stacktrace to the log. try { if (log.isDebugEnabled()) { if (t != null) { log.debug("*****************************<<stacktrace>>*******************************"); log.debug(t.getLocalizedMessage()); StackTraceElement[] ste = t.getStackTrace(); if (ste != null && ste.length > 0) { for (StackTraceElement st : ste) { ... |
void | startTestLogging(String name) Adds the test name to MDC so that sift appender can use it and log the new log events to a different file MDC.put(TEST_NAME, name); |
String | stopTestLogging() Removes the key (log file name) from MDC String name = MDC.get(TEST_NAME);
MDC.remove(TEST_NAME);
return name;
|
String | stringifyStackTrace(Exception e) A helper method that converts an Exception event's StackTrace to a String (since this didn't seem easily available in org.slf4j.Logger) return e.toString();
|
void | testLogError(String errorMessage, Exception ex) test Log Error if (testLog != null) { testLog.error(errorMessage); if (isPrintStackTrace && ex != null && testLog != null) { testLog.error(ex.getMessage(), ex); |
void | traceCall(Class> objectClass) trace Call Logger log = LoggerFactory.getLogger(objectClass); traceCall(log, 3); |
void | traceLog(final Logger log, final String logMethodName, String logMsg) TODO traceLog(log, logMethodName, logMsg, null); |
void | warn(Logger log, Object... args) warn if (log.isWarnEnabled()) { StringBuilder sb = new StringBuilder(); for (Object o : args) { sb.append(o).append(", "); log.warn(sb.toString()); |
void | warn(String format, Object... arguments) warn warn(innerGet(), format, arguments); |