List of utility methods to do slf4j Logger
void | logDebug(String string) log Debug logger.info("debug :" + string);
|
void | logEntrance(Logger logger, String methodName, String methodArguments) Logs for entrance into every public methods with Level#DEBUG . logger.debug(String.format(ENTRANCE_METHOD_PATTERN, methodName, methodArguments)); |
void | logError(final Logger logger, final String message, final Throwable cause) IntelliJ bubbles up all error level logging to user, and if there is a "cause", it makes it a clickable link and user can view the stacktrace. logger.error(message); logger.warn(message, cause); |
void | logError(Logger log, Throwable t, String message) log Error if (log.isDebugEnabled()) { log.error(message, t); } else { log.error(t.getMessage()); |
void | logError(String message, Throwable ex, Logger logger, String userId) This is used for logging exceptions with additional information in the log message. StringBuilder sb = new StringBuilder(); sb.append(getLogElement("LdapId", userId)).append(getLogElement("Exception", message)) .append(getLogElement("Cause", ex.getMessage())); logger.error(sb.toString(), ex); |
void | logErrors(Logger logger, List Efetua log de varios erros. if (strings != null) { for (String error : strings) { logger.error("logErrors :: " + error); |
void | LogException(Logger log, String descrption, Throwable e) Log Exception String msg = e.getMessage();
log.error("{}:{}", descrption, msg);
|
void | logExit(Logger logger, String methodName, String returnValue, long timeSpent) Logs for exit from every public methods with Level#DEBUG . logger.debug(String.format(EXIT_METHOD_PATTERN, methodName, returnValue, timeSpent)); |
Logger | loggerForThisClass() logger For This Class final StackTraceElement myCaller = Thread.currentThread().getStackTrace()[2]; if (!"<clinit>".equals(myCaller.getMethodName())) { throw new RuntimeException("Logger must be static"); return LoggerFactory.getLogger(myCaller.getClassName()); |
Logger | loggerWithName(Class klass, String name) logger With Name return LoggerFactory.getLogger(String.format("%s.%s", klass.getName(), name)); |