當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。