org.sonar.api.utils.log.Logger.debug()方法的使用及代码示例

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

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

Logger.debug介绍

[英]Logs a DEBUG message. Debug messages must be valuable for diagnosing production problems. They must not be used for development debugging.
[中]记录调试消息。调试消息对于诊断生产问题必须很有价值。它们不能用于开发调试。

代码示例

代码示例来源:origin: SonarSource/sonarqube

@Override
public void success() {
 LOGGER.debug("Background initialization of SonarQube done");
 this.running = false;
}

代码示例来源:origin: SonarSource/sonarqube

@Override
public void init(Path baseDir) {
 isInit = true;
 LOG.debug("Init IgnoreCommand on dir '{}'");
}

代码示例来源:origin: SonarSource/sonarqube

/**
 * No languages are installed
 */
public Languages() {
 LOG.debug("No language available");
}

代码示例来源:origin: SonarSource/sonarqube

private void logDebug(String msg, @Nullable Object[] args) {
 if (args == null) {
  logger.debug(msg);
 } else {
  logger.debug(msg, args);
 }
}

代码示例来源:origin: SonarSource/sonarqube

private void printSensors(Collection<ModuleSensorWrapper> moduleSensors, Collection<ModuleSensorWrapper> globalSensors) {
 String sensors = Stream
  .concat(moduleSensors.stream(), globalSensors.stream())
  .map(Object::toString)
  .collect(Collectors.joining(" -> "));
 LOG.debug("Sensors : {}", sensors);
}

代码示例来源:origin: SonarSource/sonarqube

private void logPlugins() {
 if (pluginsByKeys.isEmpty()) {
  LOG.debug("No plugins loaded");
 } else {
  LOG.debug("Plugins:");
  for (ScannerPlugin p : pluginsByKeys.values()) {
   LOG.debug("  * {} {} ({})", p.getName(), p.getVersion(), p.getKey());
  }
 }
}

代码示例来源:origin: SonarSource/sonarqube

private static DefaultInputModule createModule(ProjectDefinition def, int scannerComponentId) {
 LOG.debug("  Init module '{}'", def.getName());
 DefaultInputModule module = new DefaultInputModule(def, scannerComponentId);
 LOG.debug("    Base dir: {}", module.getBaseDir().toAbsolutePath().toString());
 LOG.debug("    Working dir: {}", module.getWorkDir().toAbsolutePath().toString());
 LOG.debug("    Module global encoding: {}, default locale: {}", module.getEncoding().displayName(), Locale.getDefault());
 return module;
}

代码示例来源:origin: SonarSource/sonarqube

private static void checkPeriodProperty(boolean test, String propertyValue, String testDescription, Object... args) {
 if (!test) {
  LOG.debug("Invalid code period '{}': {}", propertyValue, supplierToString(() -> format(testDescription, args)));
  throw MessageException.of(format("Invalid new code period. '%s' is not one of: " +
   "integer > 0, date before current analysis j, \"previous_version\", or version string that exists in the project' \n" +
   "Please contact a project administrator to correct this setting", propertyValue));
 }
}

代码示例来源:origin: SonarSource/sonarqube

private Optional<Period> resolveWhenNoExistingVersion(DbSession dbSession, String projectUuid, String currentVersion, String propertyValue) {
 LOG.debug("Resolving first analysis as new code period as there is no existing version");
 boolean previousVersionPeriod = LEAK_PERIOD_MODE_PREVIOUS_VERSION.equals(propertyValue);
 boolean currentVersionPeriod = currentVersion.equals(propertyValue);
 checkPeriodProperty(previousVersionPeriod || currentVersionPeriod, propertyValue,
  "No existing version. Property should be either '%s' or the current version '%s' (actual: '%s')",
  LEAK_PERIOD_MODE_PREVIOUS_VERSION, currentVersion, propertyValue);
 String periodMode = previousVersionPeriod ? LEAK_PERIOD_MODE_PREVIOUS_VERSION : LEAK_PERIOD_MODE_VERSION;
 return findOldestAnalysis(dbSession, periodMode, projectUuid);
}

代码示例来源:origin: SonarSource/sonarqube

@Override
 public void stop() {
  Loggers.get(ServerLifecycleNotifier.class).debug("Notify " + ServerStopHandler.class.getSimpleName() + " handlers...");
  for (ServerStopHandler handler : stopHandlers) {
   handler.onServerStop(server);
  }
 }
}

代码示例来源:origin: SonarSource/sonarqube

private Optional<Period> resolveVersion(DbSession dbSession, List<EventDto> versions, String propertyValue) {
 LOG.debug("Resolving new code period by version: {}", propertyValue);
 Optional<EventDto> version = versions.stream().filter(t -> propertyValue.equals(t.getName())).findFirst();
 checkPeriodProperty(version.isPresent(), propertyValue,
  "version is none of the existing ones: %s", supplierToString(() -> toVersions(versions)));
 return newPeriod(dbSession, LEAK_PERIOD_MODE_VERSION, version.get());
}

代码示例来源:origin: SonarSource/sonarqube

private boolean hasRuleMatchFor(InputComponent component, FilterableIssue issue) {
  for (WildcardPattern pattern : rulePatternByComponent.get(component)) {
   if (pattern.match(issue.ruleKey().toString())) {
    LOG.debug("Issue {} ignored by exclusion pattern {}", issue, pattern);
    return true;
   }
  }
  return false;

 }
}

代码示例来源:origin: SonarSource/sonarqube

public void resolve(DefaultIssue issue, IssueDto dbIssue, IssueMapper mapper) {
 LOG.debug("Resolve conflict on issue {}", issue.key());
 mergeFields(dbIssue, issue);
 mapper.update(IssueDto.toDtoForUpdate(issue, System.currentTimeMillis()));
}

代码示例来源:origin: SonarSource/sonarqube

@Override
public void execute(ComputationStep.Context context) {
 String branchUuid = treeRootHolder.getRoot().getUuid();
 for (ProjectIndexer indexer : indexers) {
  LOGGER.debug("Call {}", indexer);
  indexer.indexOnAnalysis(branchUuid);
 }
}

代码示例来源:origin: SonarSource/sonarqube

private static void log(WebhookDelivery delivery) {
 Optional<String> error = delivery.getErrorMessage();
 if (error.isPresent()) {
  LOGGER.debug("Failed to send webhook '{}' | url={} | message={}",
   delivery.getWebhook().getName(), delivery.getWebhook().getUrl(), error.get());
 } else {
  LOGGER.debug("Sent webhook '{}' | url={} | time={}ms | status={}",
   delivery.getWebhook().getName(), delivery.getWebhook().getUrl(), delivery.getDurationInMs().orElse(-1), delivery.getHttpStatus().orElse(-1));
 }
}

代码示例来源:origin: SonarSource/sonarqube

private void addGroups(DbSession dbSession, UserDto userDto, Collection<String> groupsToAdd, Map<String, GroupDto> groupsByName) {
 groupsToAdd.stream().map(groupsByName::get).filter(Objects::nonNull).forEach(
  groupDto -> {
   LOGGER.debug("Adding group '{}' to user '{}'", groupDto.getName(), userDto.getLogin());
   dbClient.userGroupDao().insert(dbSession, new UserGroupDto().setGroupId(groupDto.getId()).setUserId(userDto.getId()));
  });
}

代码示例来源:origin: SonarSource/sonarqube

private IgnoreCommand loadIgnoreCommand() {
 try {
  if (!scmConfiguration.isExclusionDisabled() && scmConfiguration.provider() != null) {
   return scmConfiguration.provider().ignoreCommand();
  }
 } catch (UnsupportedOperationException e) {
  LOG.debug("File exclusion based on SCM ignore information is not available with this plugin.");
 }
 return null;
}

代码示例来源:origin: SonarSource/sonarqube

private Optional<Period> resolveByDays(DbSession dbSession, String projectUuid, Integer days, String propertyValue) {
 checkPeriodProperty(days > 0, propertyValue, "number of days is <= 0");
 long analysisDate = analysisMetadataHolder.getAnalysisDate();
 List<SnapshotDto> snapshots = dbClient.snapshotDao().selectAnalysesByQuery(dbSession, createCommonQuery(projectUuid).setCreatedBefore(analysisDate).setSort(BY_DATE, ASC));
 ensureNotOnFirstAnalysis(!snapshots.isEmpty());
 Instant targetDate = DateUtils.addDays(Instant.ofEpochMilli(analysisDate), -days);
 LOG.debug("Resolving new code period by {} days: {}", days, supplierToString(() -> logDate(targetDate)));
 SnapshotDto snapshot = findNearestSnapshotToTargetDate(snapshots, targetDate);
 return Optional.of(newPeriod(LEAK_PERIOD_MODE_DAYS, String.valueOf((int) days), snapshot));
}

代码示例来源:origin: SonarSource/sonarqube

@Override
public void execute(SensorContext context) {
 Set<String> reportPaths = loadReportPaths();
 for (String reportPath : reportPaths) {
  LOG.debug("Importing issues from '{}'", reportPath);
  Path reportFilePath = context.fileSystem().resolvePath(reportPath).toPath();
  ReportParser parser = new ReportParser(reportFilePath);
  Report report = parser.parse();
  ExternalIssueImporter issueImporter = new ExternalIssueImporter(context, report);
  issueImporter.execute();
 }
}

代码示例来源:origin: SonarSource/sonarqube

private Optional<Period> resolveByDate(DbSession dbSession, String projectUuid, Instant date, String propertyValue) {
 Instant now = Instant.ofEpochMilli(system2.now());
 checkPeriodProperty(date.compareTo(now) <= 0, propertyValue,
  "date is in the future (now: '%s')", supplierToString(() -> logDate(now)));
 LOG.debug("Resolving new code period by date: {}", supplierToString(() -> logDate(date)));
 Optional<Period> period = findFirstSnapshot(dbSession, createCommonQuery(projectUuid).setCreatedAfter(date.toEpochMilli()).setSort(BY_DATE, ASC))
  .map(dto -> newPeriod(LEAK_PERIOD_MODE_DATE, DateUtils.formatDate(date), dto));
 checkPeriodProperty(period.isPresent(), propertyValue, "No analysis found created after date '%s'", supplierToString(() -> logDate(date)));
 return period;
}

相关文章