net.i2p.util.LogManager.flush()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中net.i2p.util.LogManager.flush()方法的一些代码示例,展示了LogManager.flush()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LogManager.flush()方法的具体详情如下:
包路径:net.i2p.util.LogManager
类名称:LogManager
方法名:flush

LogManager.flush介绍

[英]Flush any pending records to disk. Blocking up to 250 ms.
[中]将所有挂起的记录刷新到磁盘。阻塞高达250毫秒。

代码示例

代码示例来源:origin: i2p/i2p.i2p

/** @since 0.9.26 */
public static void test(String[] args) {
  Properties ctxProps = new Properties();
  String PROP_FORCE = "i2p.naming.blockfile.writeInAppContext";
  ctxProps.setProperty(PROP_FORCE, "true");
  I2PAppContext ctx = new I2PAppContext(ctxProps);
  NamingService ns = getNamingService("hosts.txt");
  File published = new File("test-published.txt");
  Log log = new Log(new File("test-log.txt"));
  SubscriptionList subscriptions = new SubscriptionList("test-sub.txt");
  update(ns, published, subscriptions, log);
  ctx.logManager().flush();
}

代码示例来源:origin: i2p/i2p.i2p

public void shutdown() {
  if (_writer != null) {
    //_log.log(Log.WARN, "Shutting down logger");
    // try to prevent out-of-order logging at shutdown
    flush();
    // this could generate out-of-order messages
    _writer.flushRecords(false);
    _writer.stopWriting();
    synchronized (_writer) {
      _writer.notifyAll();
    }
  }
  _records.clear();
  _limits.clear();
  _logs.clear();
  _consoleBuffer.clear();
}

代码示例来源:origin: i2p/i2p.i2p

/**
 *  @since 0.9.18
 */
private void changeState(State state) {
  State oldState;
  synchronized(_stateLock) {
    oldState = _state;
    _state = state;
  }
  if (_log != null && oldState != state && state != State.STOPPED && _log.shouldLog(Log.WARN)) {
    _log.warn("Router state change from " + oldState + " to " + state /* , new Exception() */ );
    //for debugging
    _context.logManager().flush();
  }
}

代码示例来源:origin: i2p/i2p.i2p

ctx.logManager().flush();
System.out.flush();

代码示例来源:origin: i2p/i2p.i2p

log.error("WARN" + ": error");
log.log(Log.CRIT, "WARN" + ": crit");
_context.logManager().flush();

代码示例来源:origin: i2p/i2p.i2p

log.error("DEBUG" + ": error");
log.log(Log.CRIT, "DEBUG" + ": crit");
_context.logManager().flush();

代码示例来源:origin: i2p/i2p.i2p

log.error("INFO" + ": error");
log.log(Log.CRIT, "INFO" + ": crit");
_context.logManager().flush();

代码示例来源:origin: i2p/i2p.i2p

log.error("ERROR" + ": error");
log.log(Log.CRIT, "ERROR" + ": crit");
_context.logManager().flush();

代码示例来源:origin: i2p/i2p.i2p

log.error("CRIT" + ": error");
log.log(Log.CRIT, "CRIT" + ": crit");
_context.logManager().flush();

相关文章