本文整理匯總了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();
}
}