List of utility methods to do slf4j Logger
void | alarm(String string) alarm alarm.info(string); |
void | callShell(final String shellString, final Logger log) call Shell Process process = null; try { String[] cmdArray = splitShellString(shellString); process = Runtime.getRuntime().exec(cmdArray); process.waitFor(); log.info("callShell: <{}> OK", shellString); } catch (Throwable e) { log.error("callShell: readLine IOException, " + shellString, e); ... |
void | caught(Exception e, String... bizDesc) caught if (null == e) { return; LOGGER.error(buildDesc(bizDesc), e); |
void | checkInterrupted(String type, String name, Logger logger) check Interrupted if (Thread.currentThread().isInterrupted()) { logger.error(type + "[" + name + "] interrupted."); throw new InterruptedException(type + "[" + name + "] interrupted."); |
void | cleanLoggingMdc() clean Logging Mdc org.slf4j.MDC.remove(MDC_TEST_ID_KEY); |
void | clearRequestId() Clear the request ID. MDC.remove(REQUEST_KEY); MDC.remove(REQUEST_ID_KEY); |
void | close(final AutoCloseable closeable, final Logger log) Attempt to close the specified closeable and log any eventual error. if (closeable != null) { try { closeable.close(); } catch (Exception e) { if (log != null) { String s = "unable to close stream/reader/writer: " + getMessage(e); if (log.isDebugEnabled()) log.debug(s, e); ... |
void | closeQuietly(AutoCloseable toClose, Logger log) close Quietly if (toClose != null) { try { toClose.close(); } catch (Exception e) { log.debug("Exception during close {}", e); |
void | configureXWikiLogs() If running under Maven 3.1+, where slf4j-simple is used as the logging backend, configure the SLF4J simple to have proper logging levels that do not generate too many logs. System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", WARN_LEVEL); System.setProperty("org.slf4j.simpleLogger.log.org", WARN_LEVEL); System.setProperty("org.slf4j.simpleLogger.log.org.xwiki", INFO_LEVEL); System.setProperty("org.slf4j.simpleLogger.log.hsqldb", WARN_LEVEL); System.setProperty("org.slf4j.simpleLogger.log.org.xwiki.logging.logback", ERROR_LEVEL); |
void | configureXWikiLogs() If running under Maven 3.1+, where slf4j-simple is used as the logging backend, configure the system so that logs generated by XWiki or Hibernate follow the Maven logging settings. String rootLogLevel = System.getProperty("org.slf4j.simpleLogger.defaultLogLevel"); if (rootLogLevel == null) { return; String logLevel; switch (rootLogLevel) { case DEBUG_LEVEL: case ERROR_LEVEL: ... |