本文整理汇总了Java中ch.qos.logback.classic.Level.WARN属性的典型用法代码示例。如果您正苦于以下问题:Java Level.WARN属性的具体用法?Java Level.WARN怎么用?Java Level.WARN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ch.qos.logback.classic.Level
的用法示例。
在下文中一共展示了Level.WARN属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLogbackLogLevel
private Level getLogbackLogLevel(org.slf4j.event.Level slf4jLevel) {
if(slf4jLevel.equals(org.slf4j.event.Level.INFO)) return Level.INFO;
if(slf4jLevel.equals(org.slf4j.event.Level.DEBUG)) return Level.DEBUG;
if(slf4jLevel.equals(org.slf4j.event.Level.WARN)) return Level.WARN;
if(slf4jLevel.equals(org.slf4j.event.Level.ERROR)) return Level.ERROR;
throw new IllegalArgumentException("Unknown log level");
}
示例2: setLogLevel
/**
* 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);
}
示例3: formatLogLevel
private static String formatLogLevel(Level level)
{
if ( level == Level.WARN )
{
return "warning";
}
return level.toString().toLowerCase();
}