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

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

本文整理了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

  1. @Override
  2. public void endListField(String fieldName) {
  3. if (logger.isTraceEnabled()) {
  4. logger.trace("endListField fieldName: {}", fieldName);
  5. }
  6. }

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

  1. @Override
  2. public void run() {
  3. try {
  4. isDisconnectThread.set(Boolean.TRUE);
  5. dc.onDisconnect(InternalDistributedSystem.this);
  6. } catch (CancelException e) {
  7. if (logger.isDebugEnabled()) {
  8. logger.debug("Disconnect listener <{}> thwarted by cancellation: {}", dc, e,
  9. logger.isTraceEnabled() ? e : null);
  10. }
  11. }
  12. }
  13. };

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

  1. private Set<Object> readEntryKeySet(final int size, final DataInput in)
  2. throws IOException, ClassNotFoundException {
  3. if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
  4. logger.trace(LogMarker.SERIALIZER_VERBOSE, "Reading HashSet with size {}", size);
  5. }
  6. final HashSet<Object> set = new HashSet<Object>(size);
  7. Object key;
  8. for (int i = 0; i < size; i++) {
  9. key = DataSerializer.readObject(in);
  10. set.add(key);
  11. }
  12. if (logger.isDebugEnabled()) {
  13. logger.debug("Read HashSet with {} elements: {}", size, set);
  14. }
  15. return set;
  16. }

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

  1. private void runUntilShutdown(Runnable r) {
  2. try {
  3. r.run();
  4. } catch (CancelException e) {
  5. if (logger.isTraceEnabled()) {
  6. logger.trace("Caught shutdown exception", e);
  7. }
  8. } catch (VirtualMachineError err) {
  9. SystemFailure.initiateFailure(err);
  10. // If this ever returns, rethrow the error. We're poisoned
  11. // now, so don't let this thread continue.
  12. throw err;
  13. } catch (Throwable t) {
  14. SystemFailure.checkFailure();
  15. if (isCloseInProgress()) {
  16. logger.debug("Caught unusual exception during shutdown: {}", t.getMessage(), t);
  17. } else {
  18. logger.warn("Task failed with exception", t);
  19. }
  20. }
  21. }

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

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

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

  1. /**
  2. * Processes this message. This method is invoked by the receiver of the message.
  3. *
  4. * @param dm the distribution manager that is processing the message.
  5. */
  6. @Override
  7. protected void process(final ClusterDistributionManager dm) {
  8. final long startTime = getTimestamp();
  9. if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) {
  10. logger.trace(LogMarker.DM_VERBOSE,
  11. "PRDistributedBucketSizeReplyMessage process invoking reply processor with processorId: {}",
  12. this.processorId);
  13. }
  14. ReplyProcessor21 processor = ReplyProcessor21.getProcessor(this.processorId);
  15. if (processor == null) {
  16. if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) {
  17. logger.debug("PRDistributedBucketSizeReplyMessage processor not found");
  18. }
  19. return;
  20. }
  21. processor.process(this);
  22. if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) {
  23. logger.trace(LogMarker.DM_VERBOSE, "{} Processed {}", processor, this);
  24. }
  25. dm.getStats().incReplyMessageTime(DistributionStats.getStatTime() - startTime);
  26. }

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

  1. @Override
  2. public void endListField(String fieldName) {
  3. if (logger.isTraceEnabled()) {
  4. logger.trace("endListField fieldName: {}", fieldName);
  5. }
  6. }

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

  1. /**
  2. * Run a disconnect listener in the same thread sequence as the reconnect.
  3. *
  4. * @param dc the listener to run
  5. */
  6. private void runDisconnectForReconnect(final DisconnectListener dc) {
  7. try {
  8. dc.onDisconnect(this);
  9. } catch (DistributedSystemDisconnectedException e) {
  10. if (logger.isDebugEnabled()) {
  11. logger.debug("Disconnect listener <{}> thwarted by shutdown: {}", dc, e,
  12. logger.isTraceEnabled() ? e : null);
  13. }
  14. }
  15. }

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

  1. /**
  2. * Unregisters an existing client from this server.
  3. *
  4. * @param memberId Uniquely identifies the client
  5. */
  6. public void unregisterClient(ClientProxyMembershipID memberId, boolean normalShutdown) {
  7. if (logger.isDebugEnabled()) {
  8. logger.debug("CacheClientNotifier: Unregistering all clients with member id: {}", memberId);
  9. }
  10. CacheClientProxy proxy = getClientProxy(memberId);
  11. if (proxy != null) {
  12. final boolean isTraceEnabled = logger.isTraceEnabled();
  13. if (isTraceEnabled) {
  14. logger.trace("CacheClientNotifier: Potential client: {}", proxy);
  15. }
  16. // If the proxy's member id is the same as the input member id, add
  17. // it to the set of dead proxies.
  18. if (!proxy.startRemoval()) {
  19. if (isTraceEnabled) {
  20. logger.trace("CacheClientNotifier: Potential client: {} matches {}", proxy, memberId);
  21. }
  22. closeDeadProxies(Collections.singletonList(proxy), normalShutdown);
  23. }
  24. }
  25. }

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

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

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

  1. @Override
  2. public void setPdxFieldName(String name) {
  3. if (logger.isTraceEnabled()) {
  4. logger.trace("setPdxClassName : {}", name);
  5. }
  6. m_PdxName = name;
  7. }

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

  1. private void sendDurableCqsResponseChunk(List list, boolean lastChunk, ServerConnection servConn)
  2. throws IOException {
  3. ChunkedMessage chunkedResponseMsg = servConn.getChunkedResponseMessage();
  4. chunkedResponseMsg.setNumberOfParts(1);
  5. chunkedResponseMsg.setLastChunk(lastChunk);
  6. chunkedResponseMsg.addObjPart(list, false);
  7. if (logger.isDebugEnabled()) {
  8. logger.debug("{}: Sending {} durableCQs response chunk{}", servConn.getName(),
  9. lastChunk ? " last " : " ",
  10. logger.isTraceEnabled() ? " keys=" + list + " chunk=<" + chunkedResponseMsg + ">" : "");
  11. }
  12. chunkedResponseMsg.sendChunk(servConn);
  13. }

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

  1. final boolean isDebugEnabled = logger.isDebugEnabled();
  2. final boolean isTraceEnabled = logger.isTraceEnabled();
  3. logger.debug("CacheClientNotifier: Determining client for {}", durableClientId);
  4. CacheClientProxy clientProxy = (CacheClientProxy) i.next();
  5. if (isTraceEnabled) {
  6. logger.trace("CacheClientNotifier: Checking client {}", clientProxy);
  7. logger.debug("CacheClientNotifier: {} represents the durable client {}", proxy,
  8. durableClientId);
  9. CacheClientProxy clientProxy = (CacheClientProxy) i.next();
  10. if (isTraceEnabled) {
  11. logger.trace("CacheClientNotifier: Checking initializing client {}", clientProxy);
  12. logger.debug(
  13. "CacheClientNotifier: initializing client {} represents the durable client {}",
  14. proxy, durableClientId);

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

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

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

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

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

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

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

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

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

  1. @Override
  2. public void process(DistributionManager dm, ReplyProcessor21 processor) {
  3. final long startTime = getTimestamp();
  4. final boolean isDebugEnabled = logger.isTraceEnabled(LogMarker.DM_VERBOSE);
  5. if (isDebugEnabled) {
  6. logger.trace(LogMarker.DM_VERBOSE,
  7. "FetchVersionReplyMessage process invoking reply processor with processorId:{}",
  8. this.processorId);
  9. }
  10. if (processor == null) {
  11. if (isDebugEnabled) {
  12. logger.debug("FetchVersionReplyMessage processor not found");
  13. }
  14. return;
  15. }
  16. processor.process(this);
  17. if (isDebugEnabled) {
  18. logger.trace(LogMarker.DM_VERBOSE, "{} Processed {}", processor, this);
  19. }
  20. dm.getStats().incReplyMessageTime(NanoTimer.getTime() - startTime);
  21. }

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

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

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

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

相关文章