本文整理汇总了Java中org.apache.log4j.Priority.FATAL属性的典型用法代码示例。如果您正苦于以下问题:Java Priority.FATAL属性的具体用法?Java Priority.FATAL怎么用?Java Priority.FATAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.log4j.Priority
的用法示例。
在下文中一共展示了Priority.FATAL属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLogPriority
public Priority getLogPriority() {
if ( this.traceLevel == TRACE_INFO ) {
return Priority.INFO;
} else if ( this.traceLevel == TRACE_ERROR ) {
return Priority.ERROR;
} else if ( this.traceLevel == TRACE_DEBUG) {
return Priority.DEBUG;
} else if ( this.traceLevel == TRACE_TRACE) {
return Priority.DEBUG;
} else {
return Priority.FATAL;
}
}
示例2: append_error
@Test
public void append_error() {
MockLoggingChannel log = new MockLoggingChannel();
KettleLogChannelAppender appender = new KettleLogChannelAppender(log);
Logger testLogger = Logger.getLogger(getClass());
testLogger.setLevel(Level.ALL);
// ERROR and FATAL map to "error" messages
Layout layout = new Log4jKettleLayout();
@SuppressWarnings("deprecation")
LoggingEvent errorEvent1 = new LoggingEvent("org.test", testLogger, Priority.ERROR, "Testing", null);
Exception errorException = new Exception("something went wrong!");
@SuppressWarnings("deprecation")
LoggingEvent errorEvent2 = new LoggingEvent("org.test", testLogger, Priority.ERROR, "Testing", errorException);
@SuppressWarnings("deprecation")
LoggingEvent fatalEvent1 = new LoggingEvent("org.test", testLogger, Priority.FATAL, "Testing", null);
Exception fatalException = new Exception("something went fatally wrong!");
@SuppressWarnings("deprecation")
LoggingEvent fatalEvent2 = new LoggingEvent("org.test", testLogger, Priority.FATAL, "Testing", fatalException);
appender.doAppend(errorEvent1);
appender.doAppend(errorEvent2);
appender.doAppend(fatalEvent1);
appender.doAppend(fatalEvent2);
assertEquals(0, log.getDebugMessages().size());
assertEquals(0, log.getDetailedMessages().size());
assertEquals(0, log.getBasicMessages().size());
assertEquals(0, log.getMinimalMessages().size());
assertEquals(0, log.getRowLevelMessages().size());
assertEquals(4, log.getErrorMessages().size());
assertEquals(layout.format(errorEvent1), log.getErrorMessages().get(0).getMessage());
assertEquals(layout.format(errorEvent1), log.getErrorMessages().get(1).getMessage());
assertEquals(errorException, log.getErrorMessages().get(1).getThrowable());
assertEquals(layout.format(fatalEvent1), log.getErrorMessages().get(2).getMessage());
assertEquals(layout.format(fatalEvent2), log.getErrorMessages().get(3).getMessage());
assertEquals(fatalException, log.getErrorMessages().get(3).getThrowable());
}
示例3: convertLog4JPriority
public static LogPriority convertLog4JPriority(Priority priority) {
LogPriority pri = LogPriority.INFO; // a reasonable default
if (priority == Priority.DEBUG) {
pri = LogPriority.DEBUG;
} else if (priority == Priority.ERROR) {
pri = LogPriority.ERROR;
} else if (priority == Priority.FATAL) {
pri = LogPriority.FATAL;
} else if (priority == Priority.INFO) {
pri = LogPriority.INFO;
} else if (priority == Priority.WARN) {
pri = LogPriority.WARN;
}
return pri;
}