本文整理汇总了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;未经允许,请勿转载。 |
请发表评论