Java 类org.apache.log4j.lf5.LogRecord 实例源码

项目:cacheonix-core    文件:LogFileParser.java   
private LogRecord createLogRecord(String record) {
  if (record == null || record.trim().length() == 0) {
    return null;
  }

  LogRecord lr = new Log4JLogRecord();
  lr.setMillis(parseDate(record));
  lr.setLevel(parsePriority(record));
  lr.setCategory(parseCategory(record));
  lr.setLocation(parseLocation(record));
  lr.setThreadDescription(parseThread(record));
  lr.setNDC(parseNDC(record));
  lr.setMessage(parseMessage(record));
  lr.setThrownStackTrace(parseThrowable(record));

  return lr;
}
项目:cacheonix-core    文件:CategoryExplorerModel.java   
public void addLogRecord(LogRecord lr) {
  CategoryPath path = new CategoryPath(lr.getCategory());
  addCategory(path); // create category path if it is new
  CategoryNode node = getCategoryNode(path);
  node.addRecord(); // update category node
  if (_renderFatal && lr.isFatal()) {
    TreeNode[] nodes = getPathToRoot(node);
    int len = nodes.length;
    CategoryNode parent;

    // i = 0 gives root node
    // skip node and root, loop through "parents" in between
    for (int i = 1; i < len - 1; i++) {
      parent = (CategoryNode) nodes[i];
      parent.setHasFatalChildren(true);
      nodeChanged(parent);
    }
    node.setHasFatalRecords(true);
    nodeChanged(node);
  }
}
项目:cacheonix-core    文件:LogBrokerMonitor.java   
/**
 * Add a log record message to be displayed in the LogTable.
 * This method is thread-safe as it posts requests to the SwingThread
 * rather than processing directly.
 */
public void addMessage(final LogRecord lr) {
  if (_isDisposed == true) {
    // If the frame has been disposed of, do not log any more
    // messages.
    return;
  }

  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      _categoryExplorerTree.getExplorerModel().addLogRecord(lr);
      _table.getFilteredLogTableModel().addLogRecord(lr); // update table
      updateStatusLabel(); // show updated counts
    }
  });
}
项目:cacheonix-core    文件:LogBrokerMonitor.java   
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;
}
项目:cacheonix-core    文件:LogTableRowRenderer.java   
public Component getTableCellRendererComponent(JTable table,
    Object value,
    boolean isSelected,
    boolean hasFocus,
    int row,
    int col) {

  if ((row % 2) == 0) {
    setBackground(_color);
  } else {
    setBackground(Color.white);
  }

  FilteredLogTableModel model = (FilteredLogTableModel) table.getModel();
  LogRecord record = model.getFilteredRecord(row);

  setForeground(getLogLevelColor(record.getLevel()));

  return (super.getTableCellRendererComponent(table,
      value,
      isSelected,
      hasFocus,
      row, col));
}
项目:daq-eclipse    文件:LogFileParser.java   
private LogRecord createLogRecord(String record) {
  if (record == null || record.trim().length() == 0) {
    return null;
  }

  LogRecord lr = new Log4JLogRecord();
  lr.setMillis(parseDate(record));
  lr.setLevel(parsePriority(record));
  lr.setCategory(parseCategory(record));
  lr.setLocation(parseLocation(record));
  lr.setThreadDescription(parseThread(record));
  lr.setNDC(parseNDC(record));
  lr.setMessage(parseMessage(record));
  lr.setThrownStackTrace(parseThrowable(record));

  return lr;
}
项目:daq-eclipse    文件:CategoryExplorerModel.java   
public void addLogRecord(LogRecord lr) {
  CategoryPath path = new CategoryPath(lr.getCategory());
  addCategory(path); // create category path if it is new
  CategoryNode node = getCategoryNode(path);
  node.addRecord(); // update category node
  if (_renderFatal && lr.isFatal()) {
    TreeNode[] nodes = getPathToRoot(node);
    int len = nodes.length;
    CategoryNode parent;

    // i = 0 gives root node
    // skip node and root, loop through "parents" in between
    for (int i = 1; i < len - 1; i++) {
      parent = (CategoryNode) nodes[i];
      parent.setHasFatalChildren(true);
      nodeChanged(parent);
    }
    node.setHasFatalRecords(true);
    nodeChanged(node);
  }
}
项目:daq-eclipse    文件:LogBrokerMonitor.java   
/**
 * Add a log record message to be displayed in the LogTable.
 * This method is thread-safe as it posts requests to the SwingThread
 * rather than processing directly.
 */
public void addMessage(final LogRecord lr) {
  if (_isDisposed == true) {
    // If the frame has been disposed of, do not log any more
    // messages.
    return;
  }

  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      _categoryExplorerTree.getExplorerModel().addLogRecord(lr);
      _table.getFilteredLogTableModel().addLogRecord(lr); // update table
      updateStatusLabel(); // show updated counts
    }
  });
}
项目:daq-eclipse    文件:LogBrokerMonitor.java   
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;
}
项目:daq-eclipse    文件:LogTableRowRenderer.java   
public Component getTableCellRendererComponent(JTable table,
    Object value,
    boolean isSelected,
    boolean hasFocus,
    int row,
    int col) {

  if ((row % 2) == 0) {
    setBackground(_color);
  } else {
    setBackground(Color.white);
  }

  FilteredLogTableModel model = (FilteredLogTableModel) table.getModel();
  LogRecord record = model.getFilteredRecord(row);

  setForeground(getLogLevelColor(record.getLevel()));

  return (super.getTableCellRendererComponent(table,
      value,
      isSelected,
      hasFocus,
      row, col));
}
项目:nabs    文件:LogFileParser.java   
private LogRecord createLogRecord(String record) {
  if (record == null || record.trim().length() == 0) {
    return null;
  }

  LogRecord lr = new Log4JLogRecord();
  lr.setMillis(parseDate(record));
  lr.setLevel(parsePriority(record));
  lr.setCategory(parseCategory(record));
  lr.setLocation(parseLocation(record));
  lr.setThreadDescription(parseThread(record));
  lr.setNDC(parseNDC(record));
  lr.setMessage(parseMessage(record));
  lr.setThrownStackTrace(parseThrowable(record));

  return lr;
}
项目:nabs    文件:CategoryExplorerModel.java   
public void addLogRecord(LogRecord lr) {
  CategoryPath path = new CategoryPath(lr.getCategory());
  addCategory(path); // create category path if it is new
  CategoryNode node = getCategoryNode(path);
  node.addRecord(); // update category node
  if (_renderFatal && lr.isFatal()) {
    TreeNode[] nodes = getPathToRoot(node);
    int len = nodes.length;
    CategoryNode parent;

    // i = 0 gives root node
    // skip node and root, loop through "parents" in between
    for (int i = 1; i < len - 1; i++) {
      parent = (CategoryNode) nodes[i];
      parent.setHasFatalChildren(true);
      nodeChanged(parent);
    }
    node.setHasFatalRecords(true);
    nodeChanged(node);
  }
}
项目:nabs    文件:LogBrokerMonitor.java   
/**
 * Add a log record message to be displayed in the LogTable.
 * This method is thread-safe as it posts requests to the SwingThread
 * rather than processing directly.
 */
public void addMessage(final LogRecord lr) {
  if (_isDisposed == true) {
    // If the frame has been disposed of, do not log any more
    // messages.
    return;
  }

  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      _categoryExplorerTree.getExplorerModel().addLogRecord(lr);
      _table.getFilteredLogTableModel().addLogRecord(lr); // update table
      updateStatusLabel(); // show updated counts
    }
  });
}
项目:nabs    文件:LogBrokerMonitor.java   
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;
}
项目:nabs    文件:LogTableRowRenderer.java   
public Component getTableCellRendererComponent(JTable table,
    Object value,
    boolean isSelected,
    boolean hasFocus,
    int row,
    int col) {

  if ((row % 2) == 0) {
    setBackground(_color);
  } else {
    setBackground(Color.white);
  }

  FilteredLogTableModel model = (FilteredLogTableModel) table.getModel();
  LogRecord record = model.getFilteredRecord(row);

  setForeground(getLogLevelColor(record.getLevel()));

  return (super.getTableCellRendererComponent(table,
      value,
      isSelected,
      hasFocus,
      row, col));
}
项目:cacheonix-core    文件:FilteredLogTableModel.java   
public synchronized boolean addLogRecord(LogRecord record) {

    _allRecords.add(record);

    if (_filter.passes(record) == false) {
      return false;
    }
    getFilteredRecords().add(record);
    fireTableRowsInserted(getRowCount(), getRowCount());
    trimRecords();
    return true;
  }
项目:cacheonix-core    文件:FilteredLogTableModel.java   
protected LogRecord getFilteredRecord(int row) {
  List records = getFilteredRecords();
  int size = records.size();
  if (row < size) {
    return (LogRecord) records.get(row);
  }
  // a minor problem has happened. JTable has asked for
  // a row outside the bounds, because the size of
  // _filteredRecords has changed while it was looping.
  // return the last row.
  return (LogRecord) records.get(size - 1);

}
项目:cacheonix-core    文件:FilteredLogTableModel.java   
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);
  }
}
项目:cacheonix-core    文件:LogBrokerMonitor.java   
protected int findRecord(
    int startRow,
    String searchText,
    List records
    ) {
  if (startRow < 0) {
    startRow = 0; // start at first element if no rows are selected
  } else {
    startRow++; // start after the first selected row
  }
  int len = records.size();

  for (int i = startRow; i < len; i++) {
    if (matches((LogRecord) records.get(i), searchText)) {
      return i; // found a record
    }
  }
  // wrap around to beginning if when we reach the end with no match
  len = startRow;
  for (int i = 0; i < len; i++) {
    if (matches((LogRecord) records.get(i), searchText)) {
      return i; // found a record
    }
  }
  // nothing found
  return -1;
}
项目:cacheonix-core    文件:LogBrokerMonitor.java   
/**
 * 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;
}
项目:cacheonix-core    文件:LogBrokerMonitor.java   
protected LogRecordFilter createLogRecordFilter() {
  LogRecordFilter result = new LogRecordFilter() {
    public boolean passes(LogRecord record) {
      CategoryPath path = new CategoryPath(record.getCategory());
      return
          getMenuItem(record.getLevel()).isSelected() &&
          _categoryExplorerTree.getExplorerModel().isCategoryPathActive(path);
    }
  };
  return result;
}
项目:daq-eclipse    文件:FilteredLogTableModel.java   
public synchronized boolean addLogRecord(LogRecord record) {

    _allRecords.add(record);

    if (_filter.passes(record) == false) {
      return false;
    }
    getFilteredRecords().add(record);
    fireTableRowsInserted(getRowCount(), getRowCount());
    trimRecords();
    return true;
  }
项目:daq-eclipse    文件:FilteredLogTableModel.java   
protected LogRecord getFilteredRecord(int row) {
  List records = getFilteredRecords();
  int size = records.size();
  if (row < size) {
    return (LogRecord) records.get(row);
  }
  // a minor problem has happened. JTable has asked for
  // a row outside the bounds, because the size of
  // _filteredRecords has changed while it was looping.
  // return the last row.
  return (LogRecord) records.get(size - 1);

}
项目:daq-eclipse    文件:FilteredLogTableModel.java   
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);
  }
}
项目:daq-eclipse    文件:LogBrokerMonitor.java   
protected int findRecord(
    int startRow,
    String searchText,
    List records
    ) {
  if (startRow < 0) {
    startRow = 0; // start at first element if no rows are selected
  } else {
    startRow++; // start after the first selected row
  }
  int len = records.size();

  for (int i = startRow; i < len; i++) {
    if (matches((LogRecord) records.get(i), searchText)) {
      return i; // found a record
    }
  }
  // wrap around to beginning if when we reach the end with no match
  len = startRow;
  for (int i = 0; i < len; i++) {
    if (matches((LogRecord) records.get(i), searchText)) {
      return i; // found a record
    }
  }
  // nothing found
  return -1;
}
项目:daq-eclipse    文件:LogBrokerMonitor.java   
/**
 * 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;
}
项目:daq-eclipse    文件:LogBrokerMonitor.java   
protected LogRecordFilter createLogRecordFilter() {
  LogRecordFilter result = new LogRecordFilter() {
    public boolean passes(LogRecord record) {
      CategoryPath path = new CategoryPath(record.getCategory());
      return
          getMenuItem(record.getLevel()).isSelected() &&
          _categoryExplorerTree.getExplorerModel().isCategoryPathActive(path);
    }
  };
  return result;
}
项目:nabs    文件:FilteredLogTableModel.java   
public synchronized boolean addLogRecord(LogRecord record) {

    _allRecords.add(record);

    if (_filter.passes(record) == false) {
      return false;
    }
    getFilteredRecords().add(record);
    fireTableRowsInserted(getRowCount(), getRowCount());
    trimRecords();
    return true;
  }
项目:nabs    文件:FilteredLogTableModel.java   
protected LogRecord getFilteredRecord(int row) {
  List records = getFilteredRecords();
  int size = records.size();
  if (row < size) {
    return (LogRecord) records.get(row);
  }
  // a minor problem has happened. JTable has asked for
  // a row outside the bounds, because the size of
  // _filteredRecords has changed while it was looping.
  // return the last row.
  return (LogRecord) records.get(size - 1);

}
项目:nabs    文件:FilteredLogTableModel.java   
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);
  }
}
项目:nabs    文件:LogBrokerMonitor.java   
protected int findRecord(
    int startRow,
    String searchText,
    List records
    ) {
  if (startRow < 0) {
    startRow = 0; // start at first element if no rows are selected
  } else {
    startRow++; // start after the first selected row
  }
  int len = records.size();

  for (int i = startRow; i < len; i++) {
    if (matches((LogRecord) records.get(i), searchText)) {
      return i; // found a record
    }
  }
  // wrap around to beginning if when we reach the end with no match
  len = startRow;
  for (int i = 0; i < len; i++) {
    if (matches((LogRecord) records.get(i), searchText)) {
      return i; // found a record
    }
  }
  // nothing found
  return -1;
}
项目:nabs    文件:LogBrokerMonitor.java   
/**
 * 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;
}
项目:nabs    文件:LogBrokerMonitor.java   
protected LogRecordFilter createLogRecordFilter() {
  LogRecordFilter result = new LogRecordFilter() {
    public boolean passes(LogRecord record) {
      CategoryPath path = new CategoryPath(record.getCategory());
      return
          getMenuItem(record.getLevel()).isSelected() &&
          _categoryExplorerTree.getExplorerModel().isCategoryPathActive(path);
    }
  };
  return result;
}
项目:cacheonix-core    文件:FilteredLogTableModel.java   
public Object getValueAt(int row, int col) {
  LogRecord record = getFilteredRecord(row);
  return getColumn(col, record);
}
项目:daq-eclipse    文件:FilteredLogTableModel.java   
public Object getValueAt(int row, int col) {
  LogRecord record = getFilteredRecord(row);
  return getColumn(col, record);
}
项目:nabs    文件:FilteredLogTableModel.java   
public Object getValueAt(int row, int col) {
  LogRecord record = getFilteredRecord(row);
  return getColumn(col, record);
}
项目:cacheonix-core    文件:LogMonitorAdapter.java   
/**
 * <p>Adds a LogRecord to the LogMonitor.<p>
 *
 * @param record The LogRecord object to be logged in the logging monitor.
 */
public void addMessage(LogRecord record) {
  _logMonitor.addMessage(record);
}
项目:cacheonix-core    文件:CategoryExplorerLogRecordFilter.java   
/**
 * @return true if the CategoryExplorer model specified at construction
 * is accepting the category of the specified LogRecord.  Has a side-effect
 * of adding the CategoryPath of the LogRecord to the explorer model
 * if the CategoryPath is new.
 */
public boolean passes(LogRecord record) {
  CategoryPath path = new CategoryPath(record.getCategory());
  return _model.isCategoryPathActive(path);
}
项目:daq-eclipse    文件:LogMonitorAdapter.java   
/**
 * <p>Adds a LogRecord to the LogMonitor.<p>
 *
 * @param record The LogRecord object to be logged in the logging monitor.
 */
public void addMessage(LogRecord record) {
  _logMonitor.addMessage(record);
}
项目:daq-eclipse    文件:CategoryExplorerLogRecordFilter.java   
/**
 * @return true if the CategoryExplorer model specified at construction
 * is accepting the category of the specified LogRecord.  Has a side-effect
 * of adding the CategoryPath of the LogRecord to the explorer model
 * if the CategoryPath is new.
 */
public boolean passes(LogRecord record) {
  CategoryPath path = new CategoryPath(record.getCategory());
  return _model.isCategoryPathActive(path);
}