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

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

本文整理了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

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

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

  1. @Override
  2. public void run() {
  3. setName("Log " + _id + " shutdown ");
  4. shutdown();
  5. }
  6. }

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

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

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

  1. /** @since 0.9.26 */
  2. public static void test(String[] args) {
  3. Properties ctxProps = new Properties();
  4. String PROP_FORCE = "i2p.naming.blockfile.writeInAppContext";
  5. ctxProps.setProperty(PROP_FORCE, "true");
  6. I2PAppContext ctx = new I2PAppContext(ctxProps);
  7. NamingService ns = getNamingService("hosts.txt");
  8. File published = new File("test-published.txt");
  9. Log log = new Log(new File("test-log.txt"));
  10. SubscriptionList subscriptions = new SubscriptionList("test-sub.txt");
  11. update(ns, published, subscriptions, log);
  12. ctx.logManager().flush();
  13. }

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

  1. private void rereadConfig() {
  2. long now = Clock.getInstance().now();
  3. if (now - _lastReadConfig > CONFIG_READ_INTERVAL) {
  4. _manager.rereadConfig();
  5. _lastReadConfig = now;
  6. }
  7. }

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

  1. _context.logManager().rereadConfig();
  2. log.error("INFO" + ": error");
  3. log.log(Log.CRIT, "INFO" + ": crit");
  4. _context.logManager().flush();

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

  1. public void shutdown() {
  2. if (_writer != null) {
  3. //_log.log(Log.WARN, "Shutting down logger");
  4. // try to prevent out-of-order logging at shutdown
  5. flush();
  6. // this could generate out-of-order messages
  7. _writer.flushRecords(false);
  8. _writer.stopWriting();
  9. synchronized (_writer) {
  10. _writer.notifyAll();
  11. }
  12. }
  13. _records.clear();
  14. _limits.clear();
  15. _logs.clear();
  16. _consoleBuffer.clear();
  17. }

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

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

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

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

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

  1. /**
  2. * @since 0.9.18
  3. */
  4. private void changeState(State state) {
  5. State oldState;
  6. synchronized(_stateLock) {
  7. oldState = _state;
  8. _state = state;
  9. }
  10. if (_log != null && oldState != state && state != State.STOPPED && _log.shouldLog(Log.WARN)) {
  11. _log.warn("Router state change from " + oldState + " to " + state /* , new Exception() */ );
  12. //for debugging
  13. _context.logManager().flush();
  14. }
  15. }

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

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

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

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

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

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

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

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

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

  1. public UpdateRunner(I2PAppContext ctx, UpdateManager umgr, SnarkManager smgr,
  2. UpdateType type, List<URI> uris, String newVersion) {
  3. _context = ctx;
  4. _log = ctx.logManager().getLog(getClass());
  5. _umgr = umgr;
  6. _smgr = smgr;
  7. _type = type;
  8. _urls = uris;
  9. _newVersion = newVersion;
  10. }

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

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

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

  1. /**
  2. * @param receiver non-null
  3. */
  4. public GarlicMessageReceiver(RouterContext context, CloveReceiver receiver, Hash clientDestination) {
  5. _context = context;
  6. _log = context.logManager().getLog(GarlicMessageReceiver.class);
  7. _clientDestination = clientDestination;
  8. _receiver = receiver;
  9. //_log.error("New GMR dest = " + clientDestination);
  10. // all createRateStat in OCMOSJ.init()
  11. }

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

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

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

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

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

  1. /**
  2. * @deprecated unused, see static getBids()
  3. */
  4. @Deprecated
  5. public GetBidsJob(RouterContext ctx, TransportManager tmgr, OutNetMessage msg) {
  6. super(ctx);
  7. _log = ctx.logManager().getLog(GetBidsJob.class);
  8. _tmgr = tmgr;
  9. _msg = msg;
  10. }

相关文章