本文整理汇总了Java中org.apache.log4j.Level.WARN_INT属性的典型用法代码示例。如果您正苦于以下问题:Java Level.WARN_INT属性的具体用法?Java Level.WARN_INT怎么用?Java Level.WARN_INT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.log4j.Level
的用法示例。
在下文中一共展示了Level.WARN_INT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertMsgLevel
private int convertMsgLevel( org.apache.log4j.Level level ) {
switch (level.toInt()) {
case Level.FATAL_INT:
return 1;
case Level.ERROR_INT:
return 2;
case Level.WARN_INT:
return 3;
case Level.INFO_INT:
return 4;
case Level.DEBUG_INT:
return 5;
case Level.TRACE_INT:
return 6;
case SystemLogLevel.SYSTEM_INT:
return 7;
default:
return 4;
}
}
示例2: getLogLevels
/**
* Return a long containing the encoded status of every log level for the relevant loggers.
* @return A long containing log levels for all the loggers available in the EE
*/
public final static long getLogLevels() {
long logLevels = 0;
for (int ii = 0; ii < loggers.length; ii++) {
final int level = loggers[ii].getEffectiveLevel().toInt();
switch (level) {
case Level.TRACE_INT:
logLevels |= trace << (ii * 3);
break;
case Level.ALL_INT:
logLevels |= all << (ii * 3);
break;
case Level.DEBUG_INT:
logLevels |= debug << (ii * 3);
break;
case Level.ERROR_INT:
logLevels |= error << (ii * 3);
break;
case Level.FATAL_INT:
logLevels |= fatal << (ii * 3);
break;
case Level.INFO_INT:
logLevels |= info << (ii * 3);
break;
case Level.OFF_INT:
logLevels |= off << (ii * 3);
break;
case Level.WARN_INT:
logLevels |= warn << (ii * 3);
break;
default:
throw new RuntimeException("Unhandled log level " + level);
}
}
return logLevels;
}
示例3: writeToLog
private void writeToLog(final String s) {
if ((s == null) || s.isEmpty()) {
return;
}
switch(level) {
case Level.DEBUG_INT:
logger.debug(s);
break;
case Level.ERROR_INT:
logger.error(s);
break;
case Level.INFO_INT:
logger.info(s);
break;
case Level.TRACE_INT:
logger.trace(s);
break;
case Level.WARN_INT:
logger.warn(s);
break;
default:
throw new IllegalStateException();
}
}