本文整理汇总了Java中org.apache.log4j.lf5.LogRecord.getNDC方法的典型用法代码示例。如果您正苦于以下问题:Java LogRecord.getNDC方法的具体用法?Java LogRecord.getNDC怎么用?Java LogRecord.getNDC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.log4j.lf5.LogRecord
的用法示例。
在下文中一共展示了LogRecord.getNDC方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNDCLogRecordFilter
import org.apache.log4j.lf5.LogRecord; //导入方法依赖的package包/类
protected LogRecordFilter createNDCLogRecordFilter(String text) {
_NDCTextFilter = text;
LogRecordFilter result = new LogRecordFilter() {
public boolean passes(LogRecord record) {
String NDC = record.getNDC();
CategoryPath path = new CategoryPath(record.getCategory());
if (NDC == null || _NDCTextFilter == null) {
return false;
} else if (NDC.toLowerCase().indexOf(_NDCTextFilter.toLowerCase()) == -1) {
return false;
} else {
return getMenuItem(record.getLevel()).isSelected() &&
_categoryExplorerTree.getExplorerModel().isCategoryPathActive(path);
}
}
};
return result;
}
示例2: getColumn
import org.apache.log4j.lf5.LogRecord; //导入方法依赖的package包/类
protected Object getColumn(int col, LogRecord lr) {
if (lr == null) {
return "NULL Column";
}
String date = new Date(lr.getMillis()).toString();
switch (col) {
case 0:
return date + " (" + lr.getMillis() + ")";
case 1:
return lr.getThreadDescription();
case 2:
return new Long(lr.getSequenceNumber());
case 3:
return lr.getLevel();
case 4:
return lr.getNDC();
case 5:
return lr.getCategory();
case 6:
return lr.getMessage();
case 7:
return lr.getLocation();
case 8:
return lr.getThrownStackTrace();
default:
String message = "The column number " + col + "must be between 0 and 8";
throw new IllegalArgumentException(message);
}
}
示例3: matches
import org.apache.log4j.lf5.LogRecord; //导入方法依赖的package包/类
/**
* Check to see if the any records contain the search string.
* Searching now supports NDC messages and date.
*/
protected boolean matches(LogRecord record, String text) {
String message = record.getMessage();
String NDC = record.getNDC();
if (message == null && NDC == null || text == null) {
return false;
}
if (message.toLowerCase().indexOf(text.toLowerCase()) == -1 &&
NDC.toLowerCase().indexOf(text.toLowerCase()) == -1) {
return false;
}
return true;
}