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


Java Markers类代码示例

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


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

示例1: updateOrderStatus

import net.logstash.logback.marker.Markers; //导入依赖的package包/类
/**
 * This method handles the webhook from the payment provider. It requests the status of the order with the given
 * reference
 *
 * @param orderReference Id of the order at the paymentprovider, stored in the reference field
 *
 * @return Statusmessage
 */
@PostMapping("/status")
public ResponseEntity<?> updateOrderStatus(@RequestParam(name = "id") String orderReference) {
    // Fields for logging
    Marker mollieMarker = Markers.append("request_source", "webhook");
    StructuredArgument logOrderReference = StructuredArguments.value("order_reference", orderReference);

    log.info(mollieMarker, "Incoming paymentprovicer webhook for reference: {}", orderReference, logOrderReference);
    try {
        orderService.updateOrderStatusByReference(orderReference);
    } catch (OrderNotFoundException e) {
        log.warn(mollieMarker, "Paymentprovider webhook reference could not be found: {}", orderReference,
                logOrderReference);
    }
    return createResponseEntity(HttpStatus.OK, "Status is being updated");
}
 
开发者ID:AreaFiftyLAN,项目名称:lancie-api,代码行数:24,代码来源:OrderRestController.java

示例2: report

import net.logstash.logback.marker.Markers; //导入依赖的package包/类
/**
 * Calculate and report the three parameters of Little's Law and some latency percentiles.
 *
 * <p>This just writes them to stdout, but presumably we'd be reporting them to a centralized
 * service.
 */
private void report() {
  LogstashMarker marker =
      Markers.append("all", all.interval())
          .and(Markers.append("bytes_in", bytesIn.interval()))
          .and(Markers.append("bytes_out", bytesOut.interval()));
  for (Entry<String, Recorder> entry : endpoints.entrySet()) {
    marker = marker.and(Markers.append(entry.getKey(), entry.getValue().interval()));
  }
  LOGGER.info(marker, "stats");
}
 
开发者ID:codahale,项目名称:grpc-proxy,代码行数:17,代码来源:StatsTracerFactory.java

示例3: run

import net.logstash.logback.marker.Markers; //导入依赖的package包/类
@Override
public void run() {
  try {
    final TlsContext tls = new TlsContext(trustedCertsPath, certPath, keyPath);
    final HelloWorldClient client = new HelloWorldClient(hostname, port, tls);
    try {
      final Recorder recorder =
          new Recorder(
              500,
              TimeUnit.MINUTES.toMicros(1),
              TimeUnit.MILLISECONDS.toMicros(10),
              TimeUnit.MICROSECONDS);
      LOGGER.info("Initial request: {}", client.greet(requests));
      LOGGER.info("Sending {} requests from {} threads", requests, threads);

      final ExecutorService threadPool = Executors.newFixedThreadPool(threads);
      final Instant start = Instant.now();
      for (int i = 0; i < threads; i++) {
        threadPool.execute(
            () -> {
              for (int j = 0; j < requests / threads; j++) {
                final long t = System.nanoTime();
                client.greet(j);
                recorder.record(t);
              }
            });
      }
      threadPool.shutdown();
      threadPool.awaitTermination(20, TimeUnit.MINUTES);

      final Snapshot stats = recorder.interval();
      final Duration duration = Duration.between(start, Instant.now());
      LOGGER.info(
          Markers.append("stats", stats).and(Markers.append("duration", duration.toString())),
          "{} requests in {} ({} req/sec)",
          stats.count(),
          duration,
          stats.throughput());
    } finally {
      client.shutdown();
    }
  } catch (SSLException | InterruptedException e) {
    LOGGER.error("Error running command", e);
  }
}
 
开发者ID:codahale,项目名称:grpc-proxy,代码行数:46,代码来源:HelloWorldClient.java


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