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

booleanisSlf4jPresent()
is Slfj Present
return isClassPresent("org.slf4j.Logger");
voidlog(Logger logger, int logLevel, String value)
Log given value in specified log level using provided logger instance.
switch (logLevel) {
case 1:
    logTrace(logger, value);
    break;
case 2:
    logDebug(logger, value);
    break;
case 3:
...
voidlog(Logger logger, Throwable t)
log
if (logger.isDebugEnabled()) {
    logger.debug(t.getMessage(), t);
} else {
    logger.info(t.getMessage());
voidlog(String format, Object... arguments)
Log a message.
if (null != logger) {
    logger.info(format, arguments);
} else {
    System.out.println(MessageFormatter.arrayFormat(format, arguments).getMessage());
voidlog(String message)
log
log(Level.INFO, message);
StringlogAndIdError(Logger log, String errorMessage)
log And Id Error
log.error(errorMessage);
return errorMessage;
voidlogArgs(final Logger logger, final Object[] args)
log Args
final String orderedBlend = args[0].toString();
logger.debug("Ordered blend: {}.", orderedBlend);
if (args.length == 2) {
    final String orderedFlavor = args[1].toString();
    logger.debug("Ordered flavor: {}.", orderedFlavor);
voidlogBind(Logger log, int index, Object value)
log Bind
if (log.isDebugEnabled()) {
    StringBuffer msg = new StringBuffer("binding ");
    appendBoundValue(value, msg);
    msg.append(" to parameter: ").append(index);
    log.debug(msg.toString());
voidlogBytes(byte[] data, int length, String prefix, Logger logger)
Logs sent and received bytes for debugging
if (logger.isTraceEnabled()) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < length; i++) {
        byte b = data[i];
        String byteString = Integer.toHexString(b & 0x000000FF);
        byteString = byteString.length() == 1 ? "0" + byteString : byteString;
        sb.append(" ").append(byteString);
    logger.trace(COMMUNICATION, prefix + ": " + sb.toString());
voidlogDebug(Logger logger, String mensagem, Object... params)
Verifica estado de logger e efetua log de nivel debug.
if (logger.isDebugEnabled()) {
    logger.debug(mensagem, params);