Java Code Examples for ch.qos.logback.classic.Level#TRACE

The following examples show how to use ch.qos.logback.classic.Level#TRACE . 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: LogbackLoggerSpaceFactory.java    From sofa-common-tools with Apache License 2.0 6 votes vote down vote up
private Level toLogbackLevel(AdapterLevel adapterLevel) {
    if (adapterLevel == null) {
        throw new IllegalStateException("AdapterLevel is NULL when adapter to logback.");
    }
    switch (adapterLevel) {
        case TRACE:
            return Level.TRACE;
        case DEBUG:
            return Level.DEBUG;
        case INFO:
            return Level.INFO;
        case WARN:
            return Level.WARN;
        case ERROR:
            return Level.ERROR;
        default:
            throw new IllegalStateException(adapterLevel
                                            + " is unknown when adapter to logback.");
    }
}
 
Example 2
Source File: SelfCheckHttpServer.java    From krpc with Apache License 2.0 6 votes vote down vote up
public Level toLevel(String sArg) {
    if (sArg == null) {
        return null;
    } else if (sArg.equalsIgnoreCase("ALL")) {
        return Level.ALL;
    } else if (sArg.equalsIgnoreCase("TRACE")) {
        return Level.TRACE;
    } else if (sArg.equalsIgnoreCase("DEBUG")) {
        return Level.DEBUG;
    } else if (sArg.equalsIgnoreCase("INFO")) {
        return Level.INFO;
    } else if (sArg.equalsIgnoreCase("WARN")) {
        return Level.WARN;
    } else if (sArg.equalsIgnoreCase("ERROR")) {
        return Level.ERROR;
    } else {
        return sArg.equalsIgnoreCase("OFF") ? Level.OFF : null;
    }
}
 
Example 3
Source File: SLF4JLoggerIT.java    From snowflake-jdbc with Apache License 2.0 6 votes vote down vote up
/**
 * Converts log levels in {@link LogLevel} to appropriate levels in
 * {@link Level}.
 */
private Level toLogBackLevel(LogLevel level)
{
  switch (level)
  {
    case ERROR:
      return Level.ERROR;
    case WARNING:
      return Level.WARN;
    case INFO:
      return Level.INFO;
    case DEBUG:
      return Level.DEBUG;
    case TRACE:
      return Level.TRACE;
  }

  return Level.TRACE;
}
 
Example 4
Source File: LoggingRule.java    From datakernel with Apache License 2.0 6 votes vote down vote up
private Level getAdaptedLevel(org.slf4j.event.Level level) {
	switch (level) {
		case ERROR:
			return Level.ERROR;
		case WARN:
			return Level.WARN;
		case INFO:
			return Level.INFO;
		case DEBUG:
			return Level.DEBUG;
		case TRACE:
			return Level.TRACE;
		default:
			return DEFAULT_LOGGING_LEVEL;
	}
}
 
Example 5
Source File: LogUtil.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static Level toLevel (final String str)
{
    switch (str.toUpperCase()) {
    case "ALL":
        return Level.ALL;

    case "TRACE":
        return Level.TRACE;

    case "DEBUG":
        return Level.DEBUG;

    case "INFO":
        return Level.INFO;

    case "WARN":
        return Level.WARN;

    case "ERROR":
        return Level.ERROR;

    default:
    case "OFF":
        return Level.OFF;
    }
}
 
Example 6
Source File: LoggerOutputStream.java    From NationStatesPlusPlus with MIT License 6 votes vote down vote up
@Override
public synchronized void flush() throws IOException {
	super.flush();
	String record = this.toString();
	super.reset();

	if (record.length() > 0 && !record.equals(separator) && level != Level.OFF) {
		if (level == Level.TRACE)
			log.trace(record);
		else if (level == Level.DEBUG)
			log.debug(record);
		else if (level == Level.INFO)
			log.info(record);
		else if (level == Level.WARN)
			log.warn(record);
		else if (level == Level.ERROR)
			log.error(record);
	}
}
 
Example 7
Source File: LoggingUtils.java    From heat with Apache License 2.0 5 votes vote down vote up
/**
 * This method sets the log level (logback).
 */
public void setLogLevel() {
    logLevel = System.getProperty("logLevel", LOG_LEVEL_INFO);
    Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    Level logLevelSetting;
    switch (logLevel.toLowerCase()) {
    case LOG_LEVEL_ERROR:
        logLevelSetting = Level.ERROR;
        break;
    case LOG_LEVEL_WARN:
        logLevelSetting = Level.WARN;
        break;
    case LOG_LEVEL_ALL:
        logLevelSetting = Level.ALL;
        break;
    case LOG_LEVEL_TRACE_LOG:
        logLevelSetting = Level.TRACE;
        break;
    case LOG_LEVEL_INFO:
        logLevelSetting = Level.INFO;
        break;
    case LOG_LEVEL_DEBUG:
        logLevelSetting = Level.DEBUG;
        break;
    default:
        logLevelSetting = Level.INFO;
        break;
    }
    root.setLevel(logLevelSetting);
}
 
Example 8
Source File: LogUtil.java    From audiveris with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Decode a string as a Level value.
 *
 * @param str the input string
 * @return the decoded Level value
 */
public static Level toLevel (final String str)
{
    switch (str.toUpperCase()) {
    case "ALL":
        return Level.ALL;

    case "TRACE":
        return Level.TRACE;

    case "DEBUG":
        return Level.DEBUG;

    case "INFO":
        return Level.INFO;

    case "WARN":
        return Level.WARN;

    case "ERROR":
        return Level.ERROR;

    default:
    case "OFF":
        return Level.OFF;
    }
}
 
Example 9
Source File: NettyLogLevelModifier.java    From hivemq-community-edition with Apache License 2.0 4 votes vote down vote up
@Override
public FilterReply decide(final Marker marker, final Logger logger, final Level level, final String format, final Object[] params, final Throwable t) {

    if (format == null || logger == null) {
        return FilterReply.NEUTRAL;
    }

    if (logger.getName() == null) {
        return FilterReply.NEUTRAL;
    }

    if (level == Level.DEBUG) {

        if (logger.getName().startsWith("io.netty.handler.traffic.")) {
            return FilterReply.DENY;
        } else if (logger.getName().contains("io.netty.util.internal.NativeLibraryLoader")) {
            if (t instanceof UnsatisfiedLinkError) {
                return FilterReply.DENY;
            }
            if (params == null) {
                logger.trace(marker, format, params);
                return FilterReply.DENY;
            }
            final Object[] paramList = params;
            for (final Object param : paramList) {
                if (param instanceof UnsatisfiedLinkError) {
                    return FilterReply.DENY;
                }
            }
            logger.trace(marker, format, params);
            return FilterReply.DENY;
        } else if (logger.getName().startsWith("io.netty")) {
            return traceAndSortOutUnsupportedOperationException(marker, logger, format, params, t);
        }

    } else if (level == Level.TRACE) {
        if (logger.getName().contains("io.netty.channel.nio.NioEventLoop")) {
            return sortOutUnsupportedOperationException(params, t);
        }
    }

    return FilterReply.NEUTRAL;
}