• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LogstashMarker类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: mdc

import net.logstash.logback.marker.LogstashMarker; //导入依赖的package包/类
public static DomainMarker mdc(LogstashMarker marker) {
	if(marker instanceof DomainMarker) {
		DomainMarker domainMarker = (DomainMarker)marker;
		domainMarker.pushContext();
		
		if(marker.hasReferences()) {
			Iterator<Marker> iterator = marker.iterator();
			while(iterator.hasNext()) {
				Marker next = iterator.next();
				
				if(next instanceof DomainMarker) {
					mdc((DomainMarker)next);
				}
			}
		}
		return domainMarker;
	}
	throw new IllegalArgumentException("Expected instance of " + DomainMarker.class.getName());
}
 
开发者ID:skjolber,项目名称:json-log-domain,代码行数:20,代码来源:DomainMdc.java


示例2: add

import net.logstash.logback.marker.LogstashMarker; //导入依赖的package包/类
@Override
public void add(Marker reference) {
	if(reference instanceof LogstashMarker) {

		// limit to one level to make things a bit less complicated
		if(reference.hasReferences()) {
			throw new IllegalArgumentException("Please do not nest markers in more than one level");
		}
		super.add(reference);
	} else {
		throw new IllegalArgumentException("Expected marker instance of " + LogstashMarker.class.getName());
	}
}
 
开发者ID:skjolber,项目名称:json-log-domain,代码行数:14,代码来源:DomainMarker.java


示例3: logMarkerFromRecordAndEnvelope

import net.logstash.logback.marker.LogstashMarker; //导入依赖的package包/类
private Marker logMarkerFromRecordAndEnvelope(Envelope envelope) {
    LogstashMarker logMarker = append("topic", record.topic())
            .and(append("partitionId", record.partition()))
            .and(append("distributionKey", record.key()))
            .and(append("offset", record.offset()));

    if (envelope != null) {
        logMarker
                .and(append("messageId", envelope.getMessageId()))
                .and(append("correlationId", envelope.getCorrelationId()))
                .and(append("messageType", envelope.getMessageType()));
    }

    return logMarker;
}
 
开发者ID:Sixt,项目名称:ja-micro,代码行数:16,代码来源:PartitionProcessor.java


示例4: report

import net.logstash.logback.marker.LogstashMarker; //导入依赖的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


示例5: logMessage

import net.logstash.logback.marker.LogstashMarker; //导入依赖的package包/类
private void logMessage(ServletRequest request,
                        ServletResponse response,
                        long startTime,
                        boolean isSuccess,
                        Throwable cause) {
    HttpServletRequest httpServletRequest = (HttpServletRequest) request;
    String requestMethod = httpServletRequest.getMethod();
    String requestUri = httpServletRequest.getRequestURI();
    long responseTime = clock.millis() - startTime;

    // collect markers
    Map<String, Object> fields = new ConcurrentHashMap<>();

    fields.put("requestMethod", requestMethod);
    fields.put("requestUri", requestUri);
    fields.put("responseTime", responseTime);

    if (response != null) {
        fields.put("responseCode", ((HttpServletResponse) response).getStatus());
    }

    LogstashMarker marker = appendEntries(fields);

    // format the message
    String status = isSuccess ? "processed" : "failed";
    String message = String.format("Request %s %s %s in %dms", requestMethod, requestUri, status, responseTime);

    // log the event
    if (isSuccess) {
        LOG.info(marker, message);
    } else {
        LOG.error(marker, message, cause);
    }
}
 
开发者ID:hmcts,项目名称:java-logging,代码行数:35,代码来源:RequestStatusLoggingFilter.java


示例6: onEndTask

import net.logstash.logback.marker.LogstashMarker; //导入依赖的package包/类
@Override
protected void onEndTask(String taskName, int workCurr, int workTotal, int percentDone) {
    LogstashMarker marker = append("task", taskName)
            .and(append("work", workCurr))
            .and(append("total", workTotal))
            .and(append("percent", percentDone))
            .and(append("done", true));

    log.info(marker, taskName);
}
 
开发者ID:servicosgovbr,项目名称:portal-de-servicos,代码行数:11,代码来源:LogstashProgressMonitor.java


示例7: DomainMarker

import net.logstash.logback.marker.LogstashMarker; //导入依赖的package包/类
public DomainMarker(String name, String qualifier) {
	super(LogstashMarker.MARKER_NAME_PREFIX + name);

	this.qualifier = qualifier;
}
 
开发者ID:skjolber,项目名称:json-log-domain,代码行数:6,代码来源:DomainMarker.java


示例8: checkout

import net.logstash.logback.marker.LogstashMarker; //导入依赖的package包/类
@SneakyThrows
private void checkout(String branch) {
    if (branch.equals(branchAtual)) {
        return;
    }

    try {
        Repository repository = git.getRepository();
        String novoBranch = branch.replaceAll('^' + R_HEADS, "");
        String branchRemoto = DEFAULT_REMOTE_NAME + '/' + novoBranch;

        LogstashMarker marker = append("git.branch", repository.getBranch())
                .and(append("git.state", repository.getRepositoryState().toString()))
                .and(append("checkout.to", novoBranch));

        if (repository.getRef(novoBranch) == null) {

            List<Ref> remoteBranches;
            if (ListaDeConteudo.CacheEsquentando.get()) {
                remoteBranches = singletonList(repository.getRef(branchRemoto));
            } else {
               remoteBranches = git.branchList()
                        .setListMode(REMOTE)
                        .call();
            }
        
            if (remoteBranches.contains(repository.getRef(branchRemoto))) {
                checkoutNovoBranch(novoBranch, branchRemoto);
            } else {
                checkoutNovoBranch(novoBranch, R_HEADS + MASTER);
                push(novoBranch);
            }

            criarTrackComBranchRemoto(novoBranch);

            marker = marker.and(append("checkout.branch.created", true));
        }

        Ref result = git.checkout()
                .setName(novoBranch)
                .call();

        marker = marker.and(append("checkout.result", result.getName()));

        log.info(marker, "git checkout {}", novoBranch);

        branchAtual = branch;

    } catch (Exception e) {
        branchAtual = null;
        throw e;
    }
}
 
开发者ID:servicosgovbr,项目名称:editor-de-servicos,代码行数:54,代码来源:RepositorioGit.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ShrExpr类代码示例发布时间:2022-05-23
下一篇:
Java IDataProvider类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap