本文整理汇总了Java中org.apache.log4j.Priority.INFO属性的典型用法代码示例。如果您正苦于以下问题:Java Priority.INFO属性的具体用法?Java Priority.INFO怎么用?Java Priority.INFO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.log4j.Priority
的用法示例。
在下文中一共展示了Priority.INFO属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testTaskLogAppender
/**
* test TaskLogAppender
*/
@SuppressWarnings("deprecation")
@Test (timeout=5000)
public void testTaskLogAppender(){
TaskLogAppender appender= new TaskLogAppender();
System.setProperty(TaskLogAppender.TASKID_PROPERTY,"attempt_01_02_m03_04_001");
System.setProperty(TaskLogAppender.LOGSIZE_PROPERTY, "1003");
appender.activateOptions();
assertEquals(appender.getTaskId(), "attempt_01_02_m03_04_001");
assertEquals(appender.getTotalLogFileSize(),1000);
assertEquals(appender.getIsCleanup(),false);
// test writer
Writer writer= new StringWriter();
appender.setWriter(writer);
Layout layout = new PatternLayout("%-5p [%t]: %m%n");
appender.setLayout(layout);
Category logger= Logger.getLogger(getClass().getName());
LoggingEvent event = new LoggingEvent("fqnOfCategoryClass", logger, Priority.INFO, "message", new Throwable());
appender.append(event);
appender.flush() ;
appender.close();
assertTrue(writer.toString().length()>0);
// test cleanup should not changed
appender= new TaskLogAppender();
appender.setIsCleanup(true);
appender.activateOptions();
assertEquals(appender.getIsCleanup(),true);
}
示例3: append_basic
@Test
public void append_basic() {
MockLoggingChannel log = new MockLoggingChannel();
KettleLogChannelAppender appender = new KettleLogChannelAppender(log);
Logger testLogger = Logger.getLogger(getClass());
testLogger.setLevel(Level.ALL);
Layout layout = new Log4jKettleLayout();
// ALL, INFO, and WARN messages should be interpreted as "basic" messages
@SuppressWarnings("deprecation")
LoggingEvent infoEvent = new LoggingEvent("org.test", testLogger, Priority.INFO, "Testing Info", null);
@SuppressWarnings("deprecation")
LoggingEvent warnEvent = new LoggingEvent("org.test", testLogger, Priority.WARN, "Testing Warning", null);
@SuppressWarnings("deprecation")
LoggingEvent allEvent = new LoggingEvent("org.test", testLogger, Priority.toPriority(Priority.ALL_INT), "Testing All", null);
appender.doAppend(infoEvent);
appender.doAppend(warnEvent);
appender.doAppend(allEvent);
assertEquals(0, log.getDebugMessages().size());
assertEquals(0, log.getDetailedMessages().size());
assertEquals(0, log.getErrorMessages().size());
assertEquals(0, log.getMinimalMessages().size());
assertEquals(0, log.getRowLevelMessages().size());
assertEquals(3, log.getBasicMessages().size());
assertEquals(layout.format(infoEvent), log.getBasicMessages().get(0).getMessage());
assertEquals(layout.format(warnEvent), log.getBasicMessages().get(1).getMessage());
assertEquals(layout.format(allEvent), log.getBasicMessages().get(2).getMessage());
}
示例4: 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;
}