Java Code Examples for org.slf4j.event.Level#DEBUG

The following examples show how to use org.slf4j.event.Level#DEBUG . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Slf4jEventSender.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * Override this to easily change the logging level etc.
 */
protected void performLogging(Logger log, Marker marker, String logMessage) {
    if (loggingLevel == Level.INFO) {
        log.info(marker, logMessage);
    } else if (loggingLevel == Level.DEBUG) {
        log.debug(marker, logMessage);
    } else if (loggingLevel == Level.ERROR) {
        log.error(marker, logMessage);
    } else if (loggingLevel == Level.TRACE) {
        log.trace(marker, logMessage);
    } else if (loggingLevel == Level.WARN) {
        log.warn(marker, logMessage);
    } else {
        log.info(marker, logMessage);
    }
}
 
Example 2
Source File: HyenaExceptionHandler.java    From hyena with Apache License 2.0 5 votes vote down vote up
private void logException(BaseException exp) {
    if (exp.getLogLevel() == Level.ERROR) {
        logger.error(exp.getMessage(), exp);
    } else if (exp.getLogLevel() == Level.WARN) {
        logger.warn(exp.getMessage(), exp);
    } else if (exp.getLogLevel() == Level.INFO) {
        logger.info(exp.getMessage(), exp);
    } else if (exp.getLogLevel() == Level.DEBUG) {
        logger.debug(exp.getMessage(), exp);
    } else if (exp.getLogLevel() == Level.TRACE) {
        logger.trace(exp.getMessage(), exp);
    } else {
        logger.error(exp.getMessage(), exp);
    }
}
 
Example 3
Source File: MessageContainerBase.java    From rqueue with Apache License 2.0 5 votes vote down vote up
void log(Level level, String msg, Throwable t, Object... objects) {
  if (level == Level.DEBUG && !log.isDebugEnabled()) {
    return;
  }
  if (level == Level.ERROR && !log.isErrorEnabled()) {
    return;
  }
  if (level == Level.INFO && !log.isInfoEnabled()) {
    return;
  }
  if (level == Level.WARN && !log.isWarnEnabled()) {
    return;
  }
  Object[] objects1 = new Object[objects.length + 1 + (t == null ? 0 : 1)];
  System.arraycopy(objects, 0, objects1, 1, objects.length);
  objects1[0] = groupName;
  if (t != null) {
    objects1[objects1.length - 1] = t;
  }
  String txt = "[{}] " + msg;
  switch (level) {
    case INFO:
      log.info(txt, objects1);
      break;
    case WARN:
      log.warn(txt, objects1);
      break;
    case DEBUG:
      log.debug(txt, objects1);
      break;
    case ERROR:
      log.error(txt, objects1);
      break;
    default:
      log.trace(txt, objects1);
  }
}
 
Example 4
Source File: StdErrorReporter.java    From linstor-server with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Level getCurrentLogLevel()
{
    Level level = null; // no logging, aka OFF
    org.slf4j.Logger crtLogger = mainLogger;
    if (crtLogger.isTraceEnabled())
    {
        level = Level.TRACE;
    }
    else
    if (crtLogger.isDebugEnabled())
    {
        level = Level.DEBUG;
    }
    else
    if (crtLogger.isInfoEnabled())
    {
        level = Level.INFO;
    }
    else
    if (crtLogger.isWarnEnabled())
    {
        level = Level.WARN;
    }
    else
    if (crtLogger.isErrorEnabled())
    {
        level = Level.ERROR;
    }
    return level;
}
 
Example 5
Source File: LinstorParsingUtils.java    From linstor-server with GNU General Public License v3.0 5 votes vote down vote up
public static Level asLogLevel(String logLevelRef)
{
    Level logLevel;
    if (logLevelRef == null || logLevelRef.isEmpty())
    {
        throw new ApiRcException(
            ApiCallRcImpl.simpleEntry(
                ApiConsts.FAIL_INVLD_CONF,
                "Given loglevel is null."
            )
        );
    }

    switch (logLevelRef.toUpperCase())
    {
        case "ERROR":
            logLevel = Level.ERROR;
            break;
        case "WARN":
            logLevel = Level.WARN;
            break;
        case "INFO":
            logLevel = Level.INFO;
            break;
        case "DEBUG":
            logLevel = Level.DEBUG;
            break;
        case "TRACE":
            logLevel = Level.TRACE;
            break;
        default:
            throw new ApiRcException(
                ApiCallRcImpl.simpleEntry(
                    ApiConsts.FAIL_INVLD_CONF,
                    "Given loglevel '" + logLevelRef + "' is invalid"
                )
            );
    }
    return logLevel;
}
 
Example 6
Source File: RequestLogger.java    From google-ads-java with Apache License 2.0 5 votes vote down vote up
private static void logAtLevel(Logger logger, Level level, String format, Object... argList) {
  if (level == Level.INFO) {
    logger.info(format, argList);
  } else if (level == Level.WARN) {
    logger.warn(format, argList);
  } else if (level == Level.DEBUG) {
    logger.debug(format, argList);
  } else {
    throw new IllegalStateException("Unexpected log level: " + level);
  }
}
 
Example 7
Source File: RequestLogger.java    From google-ads-java with Apache License 2.0 4 votes vote down vote up
private static boolean isLevelEnabled(Level logLevel, Logger logger) {
  return (logLevel == Level.INFO && logger.isInfoEnabled())
      || (logLevel == Level.WARN && logger.isWarnEnabled())
      || (logLevel == Level.DEBUG && logger.isDebugEnabled());
}
 
Example 8
Source File: LoggingInterceptor.java    From google-ads-java with Apache License 2.0 4 votes vote down vote up
private static Level getDetailLevel(Status status) {
  return isSuccess(status) ? Level.DEBUG : Level.INFO;
}
 
Example 9
Source File: MyLogger.java    From code-examples with MIT License 4 votes vote down vote up
@LogMessage(level=Level.DEBUG, message="This is a DEBUG message.", id=14556)
void logDebugMessage();
 
Example 10
Source File: IpcLogEntry.java    From spectator with Apache License 2.0 4 votes vote down vote up
/**
 * Resets this log entry so the instance can be reused. This helps to reduce allocations.
 */
void reset() {
  logger = null;
  level = Level.DEBUG;
  marker = null;
  startTime = -1L;
  startNanos = -1L;
  latency = -1L;
  owner = null;
  result = null;
  protocol = null;
  status = null;
  statusDetail = null;
  exception = null;
  attempt = null;
  attemptFinal = null;
  vip = null;
  endpoint = null;
  clientRegion = null;
  clientZone = null;
  clientApp = null;
  clientCluster = null;
  clientAsg = null;
  clientNode = null;
  serverRegion = null;
  serverZone = null;
  serverApp = null;
  serverCluster = null;
  serverAsg = null;
  serverNode = null;
  httpMethod = null;
  httpStatus = -1;
  uri = null;
  path = null;
  requestHeaders.clear();
  responseHeaders.clear();
  remoteAddress = null;
  remotePort = -1;
  additionalTags.clear();
  builder.delete(0, builder.length());
  inflightId = null;
}