本文整理汇总了Java中org.apache.log4j.Level.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Level.equals方法的具体用法?Java Level.equals怎么用?Java Level.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.log4j.Level
的用法示例。
在下文中一共展示了Level.equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: append
import org.apache.log4j.Level; //导入方法依赖的package包/类
@Override
public void append(LoggingEvent event) {
Level level = event.getLevel();
// depends on the api, == might not work
// see HADOOP-7055 for details
if (level.equals(Level.INFO)) {
counts.incr(INFO);
}
else if (level.equals(Level.WARN)) {
counts.incr(WARN);
}
else if (level.equals(Level.ERROR)) {
counts.incr(ERROR);
}
else if (level.equals(Level.FATAL)) {
counts.incr(FATAL);
}
}
示例2: levelToInt
import org.apache.log4j.Level; //导入方法依赖的package包/类
public static int levelToInt(Level level) {
if(level.equals(Level.INFO)) {
return TRACE_INFO;
} else if(level.equals(Level.ERROR)) {
return TRACE_ERROR;
} else if(level.equals(Level.DEBUG)) {
return TRACE_DEBUG;
} else if(level.equals(Level.WARN)) {
return TRACE_WARN;
} else if(level.equals(Level.TRACE)) {
return TRACE_TRACE;
} else if(level.equals(Level.FATAL)) {
return TRACE_FATAL;
}
return 0;
}
示例3: findLevel
import org.apache.log4j.Level; //导入方法依赖的package包/类
public static int findLevel(Level expectedLevel) {
int count = 0;
List<Log> logList = DubboAppender.logList;
for (int i = 0; i < logList.size(); i++) {
Level logLevel = logList.get(i).getLogLevel();
if (logLevel.equals(expectedLevel)) count++;
}
return count;
}
示例4: findMessage
import org.apache.log4j.Level; //导入方法依赖的package包/类
public static int findMessage(Level expectedLevel, String expectedMessage) {
int count = 0;
List<Log> logList = DubboAppender.logList;
for (int i = 0; i < logList.size(); i++) {
Level logLevel = logList.get(i).getLogLevel();
if (logLevel.equals(expectedLevel)) {
String logMessage = logList.get(i).getLogMessage();
if (logMessage.contains(expectedMessage)) count++;
}
}
return count;
}
示例5: log
import org.apache.log4j.Level; //导入方法依赖的package包/类
private void log(Level level, String msgTemplate, Object... params) {
if (xLogger.isEnabledFor(level)) {
Throwable ex = XLog.getCause(params);
String msg = XLog.format(msgTemplate, params);
if (ex == null) {
xLogger.log(level, msg);
} else {
if (level.equals(Level.WARN)) {
xLogger.warn(msg, ex);
} else {
xLogger.error(msg, ex);
}
}
}
}
示例6: toJul
import org.apache.log4j.Level; //导入方法依赖的package包/类
private static java.util.logging.Level toJul(Level log4Jlevel) {
if (log4Jlevel.equals(Level.ALL)) return java.util.logging.Level.ALL;
if (log4Jlevel.equals(Level.DEBUG)) return java.util.logging.Level.FINE;
if (log4Jlevel.equals(Level.ERROR)) return java.util.logging.Level.SEVERE;
if (log4Jlevel.equals(Level.FATAL)) return java.util.logging.Level.SEVERE;
if (log4Jlevel.equals(Level.INFO)) return java.util.logging.Level.INFO;
if (log4Jlevel.equals(Level.OFF)) return java.util.logging.Level.OFF;
if (log4Jlevel.equals(Level.TRACE)) return java.util.logging.Level.FINEST;
if (log4Jlevel.equals(Level.WARN)) return java.util.logging.Level.WARNING;
throw new IllegalStateException("Unknown log level: " + log4Jlevel);
}