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

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

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

Logger.isDebugEnabled介绍

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

代码示例

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

  1. /**
  2. * Process add/remove/update of an incoming profile.
  3. */
  4. public void processIncoming(ClusterDistributionManager dm, String adviseePath,
  5. boolean removeProfile, boolean exchangeProfiles, final List<Profile> replyProfiles) {
  6. // nothing by default; just log that nothing was done
  7. if (logger.isDebugEnabled()) {
  8. logger.debug("While processing UpdateAttributes message ignored incoming profile: {}",
  9. this);
  10. }
  11. }

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

  1. @Override
  2. public void success(String id, Tuple<Long, Settings> settings) {
  3. if(latch.getCount() <= 0) {
  4. log.error("Latch already counted down (for {} of {}) (index={})", id, Arrays.toString(events), searchguardIndex);
  5. }
  6. rs.put(id, settings);
  7. latch.countDown();
  8. if(log.isDebugEnabled()) {
  9. log.debug("Received config for {} (of {}) with current latch value={}", id, Arrays.toString(events), latch.getCount());
  10. }
  11. }

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

  1. private static void releasePRIDLock(final DistributedLockService lockService) {
  2. try {
  3. lockService.unlock(PartitionedRegionHelper.MAX_PARTITIONED_REGION_ID);
  4. if (logger.isDebugEnabled()) {
  5. logger.debug("releasePRIDLock: Released the dlock in allPartitionedRegions for {}",
  6. PartitionedRegionHelper.MAX_PARTITIONED_REGION_ID);
  7. }
  8. } catch (Exception es) {
  9. logger.warn(String.format("releasePRIDLock: unlocking %s caught an exception",
  10. Integer.valueOf(PartitionedRegionHelper.MAX_PARTITIONED_REGION_ID)),
  11. es);
  12. }
  13. }

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

  1. @Override
  2. public void close(boolean keepAlive) {
  3. if (logger.isDebugEnabled()) {
  4. logger.debug("Shutting down connection manager with keepAlive {}", keepAlive);
  5. if (!this.loadConditioningProcessor.awaitTermination(PoolImpl.SHUTDOWN_TIMEOUT,
  6. TimeUnit.MILLISECONDS)) {
  7. logger.warn("Timeout waiting for load conditioning tasks to complete");
  8. logger.error("Error stopping loadConditioningProcessor", e);
  9. } catch (InterruptedException e) {
  10. logger.error(
  11. "Interrupted stopping loadConditioningProcessor",
  12. e);

代码示例来源:origin: org.bgee.log4jdbc-log4j2/log4jdbc-log4j2-jdbc4.1

  1. @Override
  2. public void sqlTimingOccurred(Spy spy, long execTime, String methodCall,
  3. String sql)
  4. {
  5. //test useless in the current implementation,
  6. //as if error level is not enabled for this logger,
  7. //the ConnectionSpy will not be used (see isjdbcLoggingEnabled())
  8. //might maybe change one day?
  9. /*if (!LOGGER.isErrorEnabled()) {
  10. return;
  11. }*/
  12. String operation = this.getSqlOperation(sql);
  13. if (Properties.isDumpSqlFilteringOn() && !this.shouldSqlBeLogged(operation)) {
  14. return;
  15. }
  16. Marker marker = this.getStatementMarker(operation);
  17. SqlTimingOccurredMessage message =
  18. new SqlTimingOccurredMessage(spy, execTime, methodCall, sql, LOGGER.isDebugEnabled(marker));
  19. if (Properties.isSqlTimingErrorThresholdEnabled() &&
  20. execTime >= Properties.getSqlTimingErrorThresholdMsec()) {
  21. LOGGER.error(marker, message);
  22. } else if (LOGGER.isWarnEnabled()) {
  23. if (Properties.isSqlTimingWarnThresholdEnabled() &&
  24. execTime >= Properties.getSqlTimingWarnThresholdMsec()) {
  25. LOGGER.warn(marker, message);
  26. } else {
  27. LOGGER.info(marker, message);
  28. }
  29. }
  30. }

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

  1. /**
  2. * Handle rejected execution for a function execution thread. Spin off a thread directly in
  3. * this case, since that means a function is executing another function. The child function
  4. * request shouldn't be in the queue behind the parent request since the parent function is
  5. * dependent on the child function executing.
  6. */
  7. private void handleRejectedExecutionForFunctionExecutionThread(Runnable r,
  8. ThreadPoolExecutor executor) {
  9. if (logger.isDebugEnabled()) {
  10. logger.warn("An additional " + FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX
  11. + " thread is being launched to prevent slow performance due to nested function executions");
  12. }
  13. launchAdditionalThread(r, executor);
  14. }

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

  1. @Override
  2. public void onDisconnect(InternalDistributedSystem sys) {
  3. if (logger.isDebugEnabled()) {
  4. this.logger.debug("Calling AdminDistributedSystemJmxImpl#onDisconnect");
  5. this.mbeanName, notificationSequenceNumber.addAndGet(1), null));
  6. } catch (MBeanException e) {
  7. logger.warn(e.getMessage(), e);
  8. logger.warn(e.getMessage(), e);
  9. throw e;
  10. } catch (VirtualMachineError err) {
  11. logger.error(e.getMessage(), e);
  12. throw e;
  13. if (logger.isDebugEnabled()) {
  14. this.logger.debug("Completed AdminDistributedSystemJmxImpl#onDisconnect");

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

  1. public static InterClusterRequestEvaluator instantiateInterClusterRequestEvaluator(final String clazz, final Settings settings) {
  2. try {
  3. final Class<?> clazz0 = Class.forName(clazz);
  4. final InterClusterRequestEvaluator ret = (InterClusterRequestEvaluator) clazz0.getConstructor(Settings.class).newInstance(settings);
  5. addLoadedModule(clazz0);
  6. return ret;
  7. } catch (final Throwable e) {
  8. log.warn("Unable to load inter cluster request evaluator '{}' due to {}", clazz, e.toString());
  9. if(log.isDebugEnabled()) {
  10. log.debug("Stacktrace: ",e);
  11. }
  12. return new DefaultInterClusterRequestEvaluator(settings);
  13. }
  14. }

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

  1. @Override
  2. public void success(String type, Tuple<Long, Settings> settings) {
  3. if(latch.getCount() <= 0) {
  4. log.error("Latch already counted down (for {} of {}) (index={})", type, Arrays.toString(events), searchguardIndex);
  5. }
  6. rs.put(type, settings);
  7. latch.countDown();
  8. if(log.isDebugEnabled()) {
  9. log.debug("Received config for {} (of {}) with current latch value={}", type, Arrays.toString(events), latch.getCount());
  10. }
  11. }

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

  1. @Override
  2. public void endpointNoLongerInUse(Endpoint endpoint) {
  3. int count = endpointCount.decrementAndGet();
  4. if (logger.isDebugEnabled()) {
  5. logger.debug("InstantiatorRecoveryTask - EndpointNoLongerInUse. Now have {} endpoints",
  6. count);
  7. }
  8. }

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

  1. @Override
  2. public void disconnect() {
  3. try {
  4. super.disconnect();
  5. // Save existing StatAlert Definitions
  6. saveAlertDefinitionsAsSerializedObjects();
  7. /* Remove Cache Listener to listen to Cache & Region create/destroy events */
  8. if (logger.isDebugEnabled()) {
  9. logger.debug("Removing CacheAndRegionListener .... ");
  10. }
  11. removeCacheListener(cacheRegionListener);
  12. } catch (RuntimeException e) {
  13. logger.warn(e.getMessage(), e);
  14. throw e;
  15. } catch (VirtualMachineError err) {
  16. SystemFailure.initiateFailure(err);
  17. // If this ever returns, re-throw the error. We're poisoned
  18. // now, so don't let this thread continue.
  19. throw err;
  20. } catch (Error e) {
  21. // Whenever you catch Error or Throwable, you must also
  22. // catch VirtualMachineError (see above). However, there is
  23. // _still_ a possibility that you are dealing with a cascading
  24. // error condition, so you also need to check to see if the JVM
  25. // is still usable:
  26. SystemFailure.checkFailure();
  27. logger.error(e.getMessage(), e);
  28. throw e;
  29. }
  30. }

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

  1. public static PrincipalExtractor instantiatePrincipalExtractor(final String clazz) {
  2. try {
  3. final Class<?> clazz0 = Class.forName(clazz);
  4. final PrincipalExtractor ret = (PrincipalExtractor) clazz0.newInstance();
  5. addLoadedModule(clazz0);
  6. return ret;
  7. } catch (final Throwable e) {
  8. log.warn("Unable to load pricipal extractor '{}' due to {}", clazz, e.toString());
  9. if(log.isDebugEnabled()) {
  10. log.debug("Stacktrace: ",e);
  11. }
  12. return new DefaultPrincipalExtractor();
  13. }
  14. }

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

  1. private Function newFunction(final Class<Function> clazz, final boolean errorOnNoSuchMethod) {
  2. try {
  3. final Constructor<Function> constructor = clazz.getConstructor();
  4. return constructor.newInstance();
  5. } catch (NoSuchMethodException nsmex) {
  6. if (errorOnNoSuchMethod) {
  7. logger.error("Zero-arg constructor is required, but not found for class: {}",
  8. clazz.getName(), nsmex);
  9. } else {
  10. if (logger.isDebugEnabled()) {
  11. logger.debug(
  12. "Not registering function because it doesn't have a zero-arg constructor: {}",
  13. clazz.getName());
  14. }
  15. }
  16. } catch (Exception ex) {
  17. logger.error("Error when attempting constructor for function for class: {}", clazz.getName(),
  18. ex);
  19. }
  20. return null;
  21. }

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

  1. @Override
  2. public void endpointNoLongerInUse(Endpoint endpoint) {
  3. int count = endpointCount.decrementAndGet();
  4. if (logger.isDebugEnabled()) {
  5. logger.debug("PdxRegistryRecoveryListener - EndpointNoLongerInUse. Now have {} endpoints",
  6. count);
  7. }
  8. }

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

  1. if (logger.isDebugEnabled()) {
  2. logger.debug("Adding CacheAndRegionListener .... ");
  3. logger.warn(e.getMessage(), e);
  4. throw e;
  5. } catch (VirtualMachineError err) {
  6. logger.error(e.getMessage(), e);
  7. throw e;

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

  1. @Override
  2. public void run2() {
  3. TXManagerImpl mgr = TXManagerImpl.currentInstance;
  4. TXStateProxy tx = mgr.suspendedTXs.remove(txId);
  5. if (tx != null) {
  6. try {
  7. if (logger.isDebugEnabled()) {
  8. logger.debug("TX: Expiry task rolling back transaction: {}", txId);
  9. }
  10. tx.rollback();
  11. } catch (GemFireException e) {
  12. logger.warn(String.format(
  13. "Exception occurred while rolling back timed out transaction %s", txId), e);
  14. }
  15. }
  16. }
  17. }

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

  1. @Override
  2. public void run() {
  3. try {
  4. run2();
  5. } catch (VirtualMachineError e) {
  6. SystemFailure.initiateFailure(e);
  7. throw e;
  8. } catch (CancelException ignore) {
  9. if (logger.isDebugEnabled()) {
  10. logger.debug("Pool task <{}> cancelled", this);
  11. }
  12. } catch (Throwable t) {
  13. logger.error(String.format("Unexpected error in pool task <%s>", this), t);
  14. }
  15. }

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

  1. private Future<?> executeDiskStoreTask(DiskStoreTask r, ExecutorService executor) {
  2. try {
  3. return executor.submit(r);
  4. } catch (RejectedExecutionException ex) {
  5. if (logger.isDebugEnabled()) {
  6. logger.debug("Ignored compact schedule during shutdown", ex);
  7. }
  8. }
  9. return null;
  10. }

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

  1. log.debug("{} does not exist in cluster metadata", requestAliasOrIndex);
  2. continue;
  3. if(log.isDebugEnabled()) {
  4. log.debug("Aliases for {}: {}", requestAliasOrIndex, aliases);
  5. if(log.isDebugEnabled()) {
  6. log.debug(alias+" is a filtered alias "+aliasMetaData.getFilter());
  7. if(log.isDebugEnabled()) {
  8. log.debug(alias+" is not an alias or does not have a filter");
  9. log.warn("More than one ({}) filtered alias found for same index ({}). This is currently not recommended. Aliases: {}", filteredAliases.size(), requestAliasOrIndex, toString(filteredAliases));
  10. } else if (faMode.equals("disallow")) {
  11. log.error("More than one ({}) filtered alias found for same index ({}). This is currently not supported. Aliases: {}", filteredAliases.size(), requestAliasOrIndex, toString(filteredAliases));
  12. return true;
  13. } else {
  14. if (log.isDebugEnabled()) {
  15. log.debug("More than one ({}) filtered alias found for same index ({}). Aliases: {}", filteredAliases.size(), requestAliasOrIndex, toString(filteredAliases));

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

  1. /**
  2. * Process the filter profile messages.
  3. */
  4. public void processQueuedFilterProfileMsgs(List msgs) {
  5. final boolean isDebugEnabled = logger.isDebugEnabled();
  6. if (msgs != null) {
  7. Iterator iter = msgs.iterator();
  8. while (iter.hasNext()) {
  9. try {
  10. OperationMessage msg = (OperationMessage) iter.next();
  11. if (isDebugEnabled) {
  12. logger.debug("Processing the queued filter profile message :{}", msg);
  13. }
  14. msg.processRequest(this);
  15. } catch (Exception ex) {
  16. logger.warn("Exception thrown while processing queued profile messages.", ex);
  17. }
  18. }
  19. }
  20. }

相关文章