当前位置: 首页>>代码示例>>Java>>正文


Java Logger类代码示例

本文整理汇总了Java中io.vertx.core.logging.Logger的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Logger类属于io.vertx.core.logging包,在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetchWithRetry

import io.vertx.core.logging.Logger; //导入依赖的package包/类
<T> void fetchWithRetry(Logger logger, Callable<T> blockingHandler, Future<T> done) {
    vertx.executeBlocking((Future<T> fut) -> {
        try {
            fut.complete(blockingHandler.call());
        } catch (Exception e) {
            fut.fail(e);
        }
    }, ar -> {
        if (ar.failed() && !(ar.cause() instanceof AcmeRetryAfterException)) {
            done.fail(ar.cause());
            return;
        }
        if (ar.succeeded() && ar.result() != null) {
            done.complete(ar.result());
            return;
        }
        long nextSleep = ar.succeeded() ? 3000 : ((AcmeRetryAfterException) ar.cause()).getRetryAfter().getTime() - currentTimeMillis();
        logger.info("Recheck in {}ms @ {}", nextSleep, new Date(System.currentTimeMillis() + nextSleep));
        vertx.setTimer(nextSleep, timerId -> fetchWithRetry(logger, blockingHandler, done));
    });
}
 
开发者ID:xkr47,项目名称:vertx-acme4j,代码行数:22,代码来源:AcmeManager.java

示例2: init

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public void init(String[] args, Handler<AsyncResult<Vertx>> fut) {
  final Logger logger = OkapiLogger.get();

  if (args.length < 1) {
    fut.handle(Future.failedFuture("Missing command; use help"));
    return;
  }
  if (parseOptions(args, fut)) {
    return;
  }
  final String mode = conf.getString("mode", "dev");
  switch (mode) {
    case "dev":
    case "initdatabase":
    case "purgedatabase":
      deploy(new MainVerticle(), conf, Vertx.vertx(vopt), fut);
      break;
    case "cluster":
    case "proxy":
    case "deployment":
      deployClustered(logger, fut);
      break;
    default:
      fut.handle(Future.failedFuture("Unknown command '" + mode + "'"));
  }
}
 
开发者ID:folio-org,项目名称:okapi,代码行数:27,代码来源:MainDeploy.java

示例3: apply

import io.vertx.core.logging.Logger; //导入依赖的package包/类
@Override
public Statement apply(Statement base, Description description) {
  return new Statement() {
    @Override
    public void evaluate() throws Throwable {
      vertx = createVertx.get();
      try {
        Context context = vertx != null ? vertx.getOrCreateContext() : null;
        VertxUnitRunner.pushContext(context);
        base.evaluate();
      } finally {
        VertxUnitRunner.popContext();
        CountDownLatch latch = new CountDownLatch(1);
        closeVertx.accept(vertx, latch);
        try {
          if (!latch.await(30 * 1000, TimeUnit.MILLISECONDS)) {
            Logger logger = LoggerFactory.getLogger(description.getTestClass());
            logger.warn("Could not close Vert.x in tme");
          }
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
        }
      }
    }
  };
}
 
开发者ID:vert-x3,项目名称:vertx-unit,代码行数:27,代码来源:RunTestOnContext.java

示例4: main

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void main(String[] args) {
  MainDeploy d = new MainDeploy();
  d.init(args, res -> {
    if (res.failed()) {
      Logger logger = OkapiLogger.get();
      logger.error(res.cause());
      exit(1);
    }
  });
}
 
开发者ID:folio-org,项目名称:okapi,代码行数:11,代码来源:MainCluster.java

示例5: PostgresHandle

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public PostgresHandle(Vertx vertx, JsonObject conf) {
  JsonObject pgconf = new JsonObject();
  String val;

  val = Config.getSysConf("postgres_host", "", conf);
  if (!val.isEmpty()) {
    pgconf.put("host", val);
  }
  val = Config.getSysConf("postgres_port", "", conf);
  Logger logger = OkapiLogger.get();
  if (!val.isEmpty()) {
    try {
      Integer x = Integer.parseInt(val);
      pgconf.put("port", x);
    } catch (NumberFormatException e) {
      logger.warn("Bad postgres_port value: " + val + ": " + e.getMessage());
    }
  }
  val = Config.getSysConf("postgres_username", Config.getSysConf("postgres_user", "okapi", conf), conf);
  if (!val.isEmpty()) {
    pgconf.put("username", val);
  }
  val = Config.getSysConf("postgres_password", "okapi25", conf);
  if (!val.isEmpty()) {
    pgconf.put("password", val);
  }
  val = Config.getSysConf("postgres_database", "okapi", conf);
  if (!val.isEmpty()) {
    pgconf.put("database", val);
  }
  logger.debug("Connecting to postgres with " + pgconf.encode());
  cli = PostgreSQLClient.createNonShared(vertx, pgconf);
  logger.debug("created");
}
 
开发者ID:folio-org,项目名称:okapi,代码行数:35,代码来源:PostgresHandle.java

示例6: AsyncFileWriterImpl

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public AsyncFileWriterImpl(long startPosition, WriteQueueSupport<AsyncFileWriter> writeQueueSupport, Context context, AsynchronousFileChannel dataFile, Logger log) {
    this.log = log;
    this.startPosition = startPosition;
    this.writePos = startPosition;
    this.ch = dataFile;
    this.context = context;
    this.writeQueueSupport = writeQueueSupport;
    this.lastWriteTime = System.currentTimeMillis();
}
 
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:10,代码来源:AsyncFileWriterImpl.java

示例7: AsyncFileReaderImpl

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public AsyncFileReaderImpl(Context context, long startPosition, int bufferSize, long length, AsynchronousFileChannel dataFile, Logger log) {
    this.log = log;
    this.bufferSize = bufferSize;
    this.readPos = startPosition;
    this.bytesRemaining = length;
    this.startPosition = startPosition;
    this.ch = dataFile;
    this.context = context;
}
 
开发者ID:pitchpoint-solutions,项目名称:sfs,代码行数:10,代码来源:AsyncFileReaderImpl.java

示例8: logIfFailed

import io.vertx.core.logging.Logger; //导入依赖的package包/类
static <T> Handler<AsyncResult<T>> logIfFailed(final String msg, final Logger log) {
  return res -> {
    if (res.failed()) {
      if (msg != null) {
        log.error(msg, res.cause());
      } else {
        log.error(res.cause());
      }
    }
  };
}
 
开发者ID:aesteve,项目名称:nubes,代码行数:12,代码来源:AsyncUtils.java

示例9: getLogger

import io.vertx.core.logging.Logger; //导入依赖的package包/类
protected Logger getLogger() {
    return LoggerFactory.getLogger(getClass());
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:4,代码来源:TestBase.java

示例10: jvm

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void jvm(final Logger logger, final Throwable ex) {
    Fn.safeNull(logger::warn, ex);
    ex.printStackTrace();
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:5,代码来源:Log.java

示例11: zero

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void zero(final Logger logger, final ZeroException ex) {
    Fn.safeNull(logger::warn, ex);
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:4,代码来源:Log.java

示例12: vertx

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void vertx(final Logger logger, final VertxException ex) {
    Fn.safeNull(logger::warn, ex);
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:4,代码来源:Log.java

示例13: info

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void info(final Logger logger, final String pattern, final Object... rest) {
    log(logger::isInfoEnabled, logger::info, pattern, rest);
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:4,代码来源:Log.java

示例14: debug

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void debug(final Logger logger, final String pattern, final Object... rest) {
    log(() -> true, logger::debug, pattern, rest);
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:4,代码来源:Log.java

示例15: warn

import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void warn(final Logger logger, final String pattern, final Object... rest) {
    log(() -> true, logger::warn, pattern, rest);
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:4,代码来源:Log.java


注:本文中的io.vertx.core.logging.Logger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。