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

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

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

Logger.debug介绍

[英]Logs a message CharSequence with 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. private void select_NonSelectResults(Object results, List<SelectResultRow> list) {
  2. if (logger.isDebugEnabled()) {
  3. logger.debug("BeanResults : Bean Results class is {}", results.getClass());
  4. }
  5. list.add(createSelectResultRow(results));
  6. }

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

  1. @Override
  2. public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings,
  3. IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
  4. IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
  5. final List<RestHandler> handlers = new ArrayList<RestHandler>(1);
  6. if (!client && !tribeNodeClient && !disabled) {
  7. handlers.addAll(super.getRestHandlers(settings, restController, clusterSettings, indexScopedSettings, settingsFilter, indexNameExpressionResolver, nodesInCluster));
  8. if(!sslOnly) {
  9. handlers.add(new SearchGuardInfoAction(settings, restController, Objects.requireNonNull(evaluator), Objects.requireNonNull(threadPool)));
  10. handlers.add(new KibanaInfoAction(settings, restController, Objects.requireNonNull(evaluator), Objects.requireNonNull(threadPool)));
  11. handlers.add(new SearchGuardLicenseAction(settings, restController));
  12. handlers.add(new SearchGuardHealthAction(settings, restController, Objects.requireNonNull(backendRegistry)));
  13. handlers.add(new TenantInfoAction(settings, restController, Objects.requireNonNull(evaluator), Objects.requireNonNull(threadPool),
  14. Objects.requireNonNull(cs), Objects.requireNonNull(adminDns)));
  15. Collection<RestHandler> apiHandler = ReflectionHelper
  16. .instantiateMngtRestApiHandler(settings, configPath, restController, localClient, adminDns, cr, cs, Objects.requireNonNull(principalExtractor), evaluator, threadPool, Objects.requireNonNull(auditLog));
  17. handlers.addAll(apiHandler);
  18. log.debug("Added {} management rest handler(s)", apiHandler.size());
  19. }
  20. }
  21. return handlers;
  22. }

代码示例来源:origin: blynkkk/blynk-server

  1. public int delete(User user, int dashId, int deviceId, String[] pins) throws IOException {
  2. log.debug("Removing selected pin data for dashId {}, deviceId {}.", dashId, deviceId);
  3. Path userReportingPath = getUserReportingFolderPath(user);
  4. int count = 0;
  5. List<String> prefixes = new ArrayList<>();
  6. for (String pin : pins) {
  7. prefixes.add(generateFilenamePrefix(dashId, deviceId, pin));
  8. }
  9. try (DirectoryStream<Path> userReportingFolder = Files.newDirectoryStream(userReportingPath, "*")) {
  10. for (Path reportingFile : userReportingFolder) {
  11. String userFileName = reportingFile.getFileName().toString();
  12. if (containsPrefix(prefixes, userFileName)) {
  13. FileUtils.deleteQuietly(reportingFile);
  14. count++;
  15. }
  16. }
  17. }
  18. return count;
  19. }

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

  1. private void recordViewRequest(DistributionMessage request) {
  2. try {
  3. synchronized (viewRequests) {
  4. if (request instanceof JoinRequestMessage) {
  5. if (isCoordinator
  6. && !services.getConfig().getDistributionConfig().getSecurityUDPDHAlgo().isEmpty()) {
  7. services.getMessenger().initClusterKey();
  8. JoinRequestMessage jreq = (JoinRequestMessage) request;
  9. // this will inform about cluster-secret key, as we have authenticated at this point
  10. JoinResponseMessage response = new JoinResponseMessage(jreq.getSender(),
  11. services.getMessenger().getClusterSecretKey(), jreq.getRequestId());
  12. services.getMessenger().send(response);
  13. }
  14. }
  15. logger.debug("Recording the request to be processed in the next membership view");
  16. viewRequests.add(request);
  17. viewRequests.notifyAll();
  18. }
  19. } catch (RuntimeException | Error t) {
  20. logger.warn("unable to record a membership view request due to this exception", t);
  21. throw t;
  22. }
  23. }

代码示例来源:origin: org.apache.logging.log4j/log4j-core

  1. public static void main(final String[] args) {
  2. try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(),
  3. "target/test-classes/log4j2-console-highlight-logback.xml")) {
  4. LOG.fatal("Fatal message.");
  5. LOG.error("Error message.");
  6. LOG.warn("Warning message.");
  7. LOG.info("Information message.");
  8. LOG.debug("Debug message.");
  9. LOG.trace("Trace message.");
  10. LOG.error("Error message.", new IOException("test"));
  11. }
  12. }

代码示例来源: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: blynkkk/blynk-server

  1. protected void processEventorAndWebhook(User user, DashBoard dash, int deviceId, Session session, short pin,
  2. PinType pinType, String value, long now) {
  3. try {
  4. eventorProcessor.process(user, session, dash, deviceId, pin, pinType, value, now);
  5. webhookProcessor.process(session, dash, deviceId, pin, pinType, value, now);
  6. } catch (QuotaLimitException qle) {
  7. log.debug("User {} reached notification limit for eventor/webhook.", user.name);
  8. } catch (IllegalArgumentException iae) {
  9. log.debug("Error processing webhook for {}. Reason : {}", user.email, iae.getMessage());
  10. } catch (Exception e) {
  11. log.error("Error processing eventor/webhook.", e);
  12. }
  13. }

代码示例来源:origin: blynkkk/blynk-server

  1. private static void delete(Holder holder, Channel channel, int msgId,
  2. User user, DashBoard dash, int deviceId, String[] pins) {
  3. holder.blockingIOProcessor.executeHistory(() -> {
  4. try {
  5. int removedCounter = holder.reportingDiskDao.delete(user, dash.id, deviceId, pins);
  6. log.debug("Removed {} files for dashId {} and deviceId {}", removedCounter, dash.id, deviceId);
  7. channel.writeAndFlush(ok(msgId), channel.voidPromise());
  8. } catch (Exception e) {
  9. log.warn("Error removing device data. Reason : {}.", e.getMessage());
  10. channel.writeAndFlush(illegalCommand(msgId), channel.voidPromise());
  11. }
  12. });
  13. }

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

  1. @Override
  2. protected void initializeMessageQueue(String id) {
  3. for (int i = 0; i < sender.getDispatcherThreads(); i++) {
  4. processors.add(
  5. new SerialGatewaySenderEventProcessor(this.sender, id + "." + i, getThreadMonitorObj()));
  6. if (logger.isDebugEnabled()) {
  7. logger.debug("Created the SerialGatewayEventProcessor_{}->{}", i, processors.get(i));
  8. }
  9. }
  10. }

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

  1. @Override
  2. public void execute(FunctionContext context) {
  3. try {
  4. RegionFunctionContext ctx = (RegionFunctionContext) context;
  5. Region region = PartitionRegionHelper.getLocalDataForContext(ctx);
  6. Set<?> keys = ctx.getFilter();
  7. List<PageEntry> results = new PageResults(keys.size());
  8. for (Object key : keys) {
  9. PageEntry entry = getEntry(region, key);
  10. if (entry != null) {
  11. results.add(entry);
  12. }
  13. }
  14. ctx.getResultSender().lastResult(results);
  15. } catch (CacheClosedException | PrimaryBucketException e) {
  16. logger.debug("Exception during lucene query function", e);
  17. throw new InternalFunctionInvocationTargetException(e);
  18. }
  19. }

代码示例来源:origin: org.apache.logging.log4j/log4j-core

  1. public static void main(final String[] args) {
  2. System.setProperty("log4j.skipJansi", "false"); // LOG4J2-2087: explicitly enable
  3. try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(),
  4. "target/test-classes/log4j2-console.xml")) {
  5. LOG.fatal("\u001b[1;35mFatal message.\u001b[0m");
  6. LOG.error("\u001b[1;31mError message.\u001b[0m");
  7. LOG.warn("\u001b[0;33mWarning message.\u001b[0m");
  8. LOG.info("\u001b[0;32mInformation message.\u001b[0m");
  9. LOG.debug("\u001b[0;36mDebug message.\u001b[0m");
  10. LOG.trace("\u001b[0;30mTrace message.\u001b[0m");
  11. LOG.error("\u001b[1;31mError message.\u001b[0m", new IOException("test"));
  12. }
  13. }

代码示例来源: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 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: apache/hive

  1. public LlapWrappedAppender(final String name, final Node node, final Configuration config,
  2. boolean renameOnClose, String renamedFileSuffix) {
  3. super(name, null, null);
  4. this.node = node;
  5. this.config = config;
  6. this.renameFileOnClose = renameOnClose;
  7. this.renamedFileSuffix = renamedFileSuffix;
  8. if (LOGGER.isDebugEnabled()) {
  9. LOGGER.debug(
  10. LlapWrappedAppender.class.getName() + " created with name=" + name + ", renameOnClose=" +
  11. renameOnClose + ", renamedFileSuffix=" + renamedFileSuffix);
  12. }
  13. }

代码示例来源:origin: blynkkk/blynk-server

  1. public static DashBoard deepCopy(DashBoard dash) {
  2. if (dash == null) {
  3. return null;
  4. }
  5. try {
  6. TokenBuffer tb = new TokenBuffer(JsonParser.MAPPER, false);
  7. JsonParser.MAPPER.writeValue(tb, dash);
  8. return JsonParser.MAPPER.readValue(tb.asParser(), DashBoard.class);
  9. } catch (Exception e) {
  10. log.error("Error during deep copy of dashboard. Reason : {}", e.getMessage());
  11. log.debug(e);
  12. }
  13. return null;
  14. }

代码示例来源:origin: blynkkk/blynk-server

  1. private static void delete(Holder holder, Channel channel, int msgId, User user, DashBoard dash, int... deviceIds) {
  2. holder.blockingIOProcessor.executeHistory(() -> {
  3. try {
  4. for (int deviceId : deviceIds) {
  5. int removedCounter = holder.reportingDiskDao.delete(user, dash.id, deviceId);
  6. log.debug("Removed {} files for dashId {} and deviceId {}", removedCounter, dash.id, deviceId);
  7. }
  8. channel.writeAndFlush(ok(msgId), channel.voidPromise());
  9. } catch (Exception e) {
  10. log.warn("Error removing device data. Reason : {}.", e.getMessage());
  11. channel.writeAndFlush(illegalCommand(msgId), channel.voidPromise());
  12. }
  13. });
  14. }

相关文章