org.apache.logging.log4j.Logger.isTraceEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(179)

本文整理了Java中org.apache.logging.log4j.Logger.isTraceEnabled()方法的一些代码示例,展示了Logger.isTraceEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.isTraceEnabled()方法的具体详情如下:
包路径:org.apache.logging.log4j.Logger
类名称:Logger
方法名:isTraceEnabled

Logger.isTraceEnabled介绍

[英]Checks whether this Logger is enabled for the Level#TRACE level.
[中]检查是否为#跟踪级别启用此记录器。

代码示例

代码示例来源:origin: apache/geode

@Override
public void endListField(String fieldName) {
 if (logger.isTraceEnabled()) {
  logger.trace("endListField fieldName: {}", fieldName);
 }
}

代码示例来源:origin: apache/geode

@Override
 public void run() {
  try {
   isDisconnectThread.set(Boolean.TRUE);
   dc.onDisconnect(InternalDistributedSystem.this);
  } catch (CancelException e) {
   if (logger.isDebugEnabled()) {
    logger.debug("Disconnect listener <{}> thwarted by cancellation: {}", dc, e,
      logger.isTraceEnabled() ? e : null);
   }
  }
 }
};

代码示例来源:origin: apache/geode

private Set<Object> readEntryKeySet(final int size, final DataInput in)
  throws IOException, ClassNotFoundException {
 if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
  logger.trace(LogMarker.SERIALIZER_VERBOSE, "Reading HashSet with size {}", size);
 }
 final HashSet<Object> set = new HashSet<Object>(size);
 Object key;
 for (int i = 0; i < size; i++) {
  key = DataSerializer.readObject(in);
  set.add(key);
 }
 if (logger.isDebugEnabled()) {
  logger.debug("Read HashSet with {} elements: {}", size, set);
 }
 return set;
}

代码示例来源:origin: apache/geode

private void runUntilShutdown(Runnable r) {
 try {
  r.run();
 } catch (CancelException e) {
  if (logger.isTraceEnabled()) {
   logger.trace("Caught shutdown exception", e);
  }
 } catch (VirtualMachineError err) {
  SystemFailure.initiateFailure(err);
  // If this ever returns, rethrow the error. We're poisoned
  // now, so don't let this thread continue.
  throw err;
 } catch (Throwable t) {
  SystemFailure.checkFailure();
  if (isCloseInProgress()) {
   logger.debug("Caught unusual exception during shutdown: {}", t.getMessage(), t);
  } else {
   logger.warn("Task failed with exception", t);
  }
 }
}

代码示例来源:origin: floragunncom/search-guard

if (log.isTraceEnabled()) {
  log.trace("Treat certificate with principal {} as other node because of it matches one of {}", Arrays.toString(principals),
      nodesDn);
if (log.isTraceEnabled()) {
  log.trace("Treat certificate with principal {} NOT as other node because we it does not matches one of {}", Arrays.toString(principals),
      nodesDn);
  if (log.isTraceEnabled()) {
    log.trace("No subject alternative names (san) found");
if (log.isDebugEnabled()) {
  log.debug("Exception parsing certificate using {}", e, this.getClass());

代码示例来源:origin: apache/geode

/**
 * Processes this message. This method is invoked by the receiver of the message.
 *
 * @param dm the distribution manager that is processing the message.
 */
@Override
protected void process(final ClusterDistributionManager dm) {
 final long startTime = getTimestamp();
 if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) {
  logger.trace(LogMarker.DM_VERBOSE,
    "PRDistributedBucketSizeReplyMessage process invoking reply processor with processorId: {}",
    this.processorId);
 }
 ReplyProcessor21 processor = ReplyProcessor21.getProcessor(this.processorId);
 if (processor == null) {
  if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) {
   logger.debug("PRDistributedBucketSizeReplyMessage processor not found");
  }
  return;
 }
 processor.process(this);
 if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) {
  logger.trace(LogMarker.DM_VERBOSE, "{} Processed {}", processor, this);
 }
 dm.getStats().incReplyMessageTime(DistributionStats.getStatTime() - startTime);
}

代码示例来源:origin: apache/geode

@Override
public void endListField(String fieldName) {
 if (logger.isTraceEnabled()) {
  logger.trace("endListField fieldName: {}", fieldName);
 }
}

代码示例来源:origin: apache/geode

/**
 * Run a disconnect listener in the same thread sequence as the reconnect.
 *
 * @param dc the listener to run
 */
private void runDisconnectForReconnect(final DisconnectListener dc) {
 try {
  dc.onDisconnect(this);
 } catch (DistributedSystemDisconnectedException e) {
  if (logger.isDebugEnabled()) {
   logger.debug("Disconnect listener <{}> thwarted by shutdown: {}", dc, e,
     logger.isTraceEnabled() ? e : null);
  }
 }
}

代码示例来源:origin: apache/geode

/**
 * Unregisters an existing client from this server.
 *
 * @param memberId Uniquely identifies the client
 */
public void unregisterClient(ClientProxyMembershipID memberId, boolean normalShutdown) {
 if (logger.isDebugEnabled()) {
  logger.debug("CacheClientNotifier: Unregistering all clients with member id: {}", memberId);
 }
 CacheClientProxy proxy = getClientProxy(memberId);
 if (proxy != null) {
  final boolean isTraceEnabled = logger.isTraceEnabled();
  if (isTraceEnabled) {
   logger.trace("CacheClientNotifier: Potential client: {}", proxy);
  }
  // If the proxy's member id is the same as the input member id, add
  // it to the set of dead proxies.
  if (!proxy.startRemoval()) {
   if (isTraceEnabled) {
    logger.trace("CacheClientNotifier: Potential client: {} matches {}", proxy, memberId);
   }
   closeDeadProxies(Collections.singletonList(proxy), normalShutdown);
  }
 }
}

代码示例来源:origin: apache/geode

@Override
protected void process(ClusterDistributionManager dm) {
 try {
  if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) {
   logger.trace(LogMarker.DM_VERBOSE, "{}: processing message {}", getClass().getName(), this);
  }
  IdentityReplyMessage.send(getSender(), getProcessorId(), dm);
 } catch (VirtualMachineError err) {
  SystemFailure.initiateFailure(err);
  // If this ever returns, rethrow the error. We're poisoned
  // now, so don't let this thread continue.
  throw err;
 } catch (Throwable t) {
  // Whenever you catch Error or Throwable, you must also
  // catch VirtualMachineError (see above). However, there is
  // _still_ a possibility that you are dealing with a cascading
  // error condition, so you also need to check to see if the JVM
  // is still usable:
  SystemFailure.checkFailure();
  logger.debug("{} Caught throwable {}", this, t.getMessage(), t);
 }
}

代码示例来源:origin: apache/geode

@Override
public void setPdxFieldName(String name) {
 if (logger.isTraceEnabled()) {
  logger.trace("setPdxClassName : {}", name);
 }
 m_PdxName = name;
}

代码示例来源:origin: apache/geode

private void sendDurableCqsResponseChunk(List list, boolean lastChunk, ServerConnection servConn)
  throws IOException {
 ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
 chunkedResponseMsg.setNumberOfParts(1);
 chunkedResponseMsg.setLastChunk(lastChunk);
 chunkedResponseMsg.addObjPart(list, false);
 if (logger.isDebugEnabled()) {
  logger.debug("{}: Sending {} durableCQs response chunk{}", servConn.getName(),
    lastChunk ? " last " : " ",
    logger.isTraceEnabled() ? " keys=" + list + " chunk=<" + chunkedResponseMsg + ">" : "");
 }
 chunkedResponseMsg.sendChunk(servConn);
}

代码示例来源:origin: apache/geode

final boolean isDebugEnabled = logger.isDebugEnabled();
final boolean isTraceEnabled = logger.isTraceEnabled();
 logger.debug("CacheClientNotifier: Determining client for {}", durableClientId);
 CacheClientProxy clientProxy = (CacheClientProxy) i.next();
 if (isTraceEnabled) {
  logger.trace("CacheClientNotifier: Checking client {}", clientProxy);
   logger.debug("CacheClientNotifier: {} represents the durable client {}", proxy,
     durableClientId);
  CacheClientProxy clientProxy = (CacheClientProxy) i.next();
  if (isTraceEnabled) {
   logger.trace("CacheClientNotifier: Checking initializing client {}", clientProxy);
    logger.debug(
      "CacheClientNotifier: initializing client {} represents the durable client {}",
      proxy, durableClientId);

代码示例来源:origin: apache/geode

@Override
protected void process(ClusterDistributionManager dm) {
 try {
  if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) {
   logger.trace(LogMarker.DM_VERBOSE, "{}: processing message {}", getClass().getName(), this);
  }
  IdentityRequestMessage.setLatestId(this.newId);
  ReplyMessage.send(getSender(), getProcessorId(), null, dm);
 } catch (VirtualMachineError err) {
  SystemFailure.initiateFailure(err);
  // If this ever returns, rethrow the error. We're poisoned
  // now, so don't let this thread continue.
  throw err;
 } catch (Throwable t) {
  // Whenever you catch Error or Throwable, you must also
  // catch VirtualMachineError (see above). However, there is
  // _still_ a possibility that you are dealing with a cascading
  // error condition, so you also need to check to see if the JVM
  // is still usable:
  SystemFailure.checkFailure();
  logger.debug("{} Caught throwable {}", this, t.getMessage(), t);
 }
}

代码示例来源:origin: apache/geode

private void logRecordVersion(long version) {
 if (logger.isTraceEnabled(LogMarker.RVV_VERBOSE)) {
  logger.trace(LogMarker.RVV_VERBOSE, "Added rvv exception e<rv{} - rv{}>", this.version,
    version);
 }
}

代码示例来源:origin: apache/geode

private static void sendKeySetResponseChunk(Region region, List list, boolean lastChunk,
  ServerConnection servConn) throws IOException {
 ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
 chunkedResponseMsg.setNumberOfParts(1);
 chunkedResponseMsg.setLastChunk(lastChunk);
 chunkedResponseMsg.addObjPart(list, false);
 if (logger.isDebugEnabled()) {
  logger.debug("{}: Sending {} key set response chunk for region={}{}", servConn.getName(),
    (lastChunk ? " last " : " "), region.getFullPath(),
    (logger.isTraceEnabled() ? " keys=" + list + " chunk=<" + chunkedResponseMsg + ">" : ""));
 }
 chunkedResponseMsg.sendChunk(servConn);
}

代码示例来源:origin: floragunncom/search-guard

public Resolved resolveRequest(final Object request) {
  if(log.isDebugEnabled()) {
    log.debug("Resolve aliases, indices and types from {}", request.getClass().getSimpleName());
  if(log.isTraceEnabled()) {
    log.trace("Finally resolved for {}: {}", request.getClass().getSimpleName(), resolvedBuilder.build());

代码示例来源:origin: apache/geode

@Override
public void process(DistributionManager dm, ReplyProcessor21 processor) {
 final long startTime = getTimestamp();
 final boolean isDebugEnabled = logger.isTraceEnabled(LogMarker.DM_VERBOSE);
 if (isDebugEnabled) {
  logger.trace(LogMarker.DM_VERBOSE,
    "FetchVersionReplyMessage process invoking reply processor with processorId:{}",
    this.processorId);
 }
 if (processor == null) {
  if (isDebugEnabled) {
   logger.debug("FetchVersionReplyMessage processor not found");
  }
  return;
 }
 processor.process(this);
 if (isDebugEnabled) {
  logger.trace(LogMarker.DM_VERBOSE, "{}  Processed  {}", processor, this);
 }
 dm.getStats().incReplyMessageTime(NanoTimer.getTime() - startTime);
}

代码示例来源:origin: apache/geode

protected void log(final String name, final Number value) {
  if (logger.isTraceEnabled()) {
   logger.trace("Monitor = {} descriptor = {} And value = {}", monitorName, name, value);
  }
 }
}

代码示例来源:origin: apache/geode

private static void sendGetAllResponseChunk(Region region, ObjectPartList list, boolean lastChunk,
  ServerConnection servConn) throws IOException {
 ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
 chunkedResponseMsg.setNumberOfParts(1);
 chunkedResponseMsg.setLastChunk(lastChunk);
 chunkedResponseMsg.addObjPartNoCopying(list);
 if (logger.isDebugEnabled()) {
  logger.debug("{}: Sending {} getAll response chunk for region={}{}", servConn.getName(),
    (lastChunk ? " last " : " "), region.getFullPath(), (logger.isTraceEnabled()
      ? " values=" + list + " chunk=<" + chunkedResponseMsg + ">" : ""));
 }
 chunkedResponseMsg.sendChunk(servConn);
}

相关文章