net.i2p.util.LogManager类的使用及代码示例

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

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

LogManager介绍

[英]Manages the logging system, loading (and reloading) the configuration file, coordinating the log limits, and storing the set of log records pending. This also fires off a LogWriter thread that pulls pending records off and writes them where appropriate.
[中]管理日志系统,加载(和重新加载)配置文件,协调日志限制,并存储挂起的日志记录集。这也会触发一个LogWriter线程,该线程会提取挂起的记录并在适当的地方写入它们。

代码示例

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

public FloodfillMonitorJob(RouterContext context, FloodfillNetworkDatabaseFacade facade) {
  super(context);
  _facade = facade;
  _log = context.logManager().getLog(FloodfillMonitorJob.class);
}

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

@Override
  public void run() {
    setName("Log " + _id + " shutdown ");
    shutdown();
  }
}

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

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

代码示例来源: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

private void rereadConfig() {
  long now = Clock.getInstance().now();
  if (now - _lastReadConfig > CONFIG_READ_INTERVAL) {
    _manager.rereadConfig();
    _lastReadConfig = now;
  }
}

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

_context.logManager().rereadConfig();
  log.error("INFO" + ": error");
  log.log(Log.CRIT, "INFO" + ": crit");
  _context.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

public HandlerImpl(I2PAppContext context, int type) {
  _context = context;
  _type = type;
  _log = context.logManager().getLog(getClass());
}

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

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

代码示例来源: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

clearCaches();
_log.log(Log.CRIT, "Shutdown(" + exitCode + ") complete"  /* , new Exception("Shutdown") */ );
try { _context.logManager().shutdown(); } catch (Throwable t) { }
if (ALLOW_DYNAMIC_KEYS) {
  if (_context.getBooleanProperty(PROP_DYNAMIC_KEYS))

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

public InternalTrayManager(RouterContext ctx, Main main, boolean useSwing) {
  super(ctx, main, useSwing);
  _context = ctx;
  log = ctx.logManager().getLog(InternalTrayManager.class);
}

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

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

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

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

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

public UpdateRunner(I2PAppContext ctx, UpdateManager umgr, SnarkManager smgr,
          UpdateType type, List<URI> uris, String newVersion) { 
  _context = ctx;
  _log = ctx.logManager().getLog(getClass());
  _umgr = umgr;
  _smgr = smgr;
  _type = type;
  _urls = uris;
  _newVersion = newVersion;
}

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

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

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

/**
 *  @param receiver non-null
 */
public GarlicMessageReceiver(RouterContext context, CloveReceiver receiver, Hash clientDestination) {
  _context = context;
  _log = context.logManager().getLog(GarlicMessageReceiver.class);
  _clientDestination = clientDestination;
  _receiver = receiver;
  //_log.error("New GMR dest = " + clientDestination);
  // all createRateStat in OCMOSJ.init()
}

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

public OutboundGatewayProcessor(I2PAppContext ctx, TunnelCreatorConfig cfg) {
  _context = ctx;
  _log = ctx.logManager().getLog(OutboundGatewayProcessor.class);
  _config = cfg;
}

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

public RefreshRoutersJob(RouterContext ctx, FloodfillNetworkDatabaseFacade facade) {
  super(ctx);
  _log = ctx.logManager().getLog(RefreshRoutersJob.class);
  _facade = facade;
}

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

/**
 *  @deprecated unused, see static getBids()
 */
@Deprecated
public GetBidsJob(RouterContext ctx, TransportManager tmgr, OutNetMessage msg) {
  super(ctx);
  _log = ctx.logManager().getLog(GetBidsJob.class);
  _tmgr = tmgr;
  _msg = msg;
}

相关文章