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

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

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

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

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

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

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

  1. /**
  2. * No languages are installed
  3. */
  4. public Languages() {
  5. LOG.debug("No language available");
  6. }

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

  1. private void logDebug(String msg, @Nullable Object[] args) {
  2. if (args == null) {
  3. logger.debug(msg);
  4. } else {
  5. logger.debug(msg, args);
  6. }
  7. }

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

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

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

  1. private void logPlugins() {
  2. if (pluginsByKeys.isEmpty()) {
  3. LOG.debug("No plugins loaded");
  4. } else {
  5. LOG.debug("Plugins:");
  6. for (ScannerPlugin p : pluginsByKeys.values()) {
  7. LOG.debug(" * {} {} ({})", p.getName(), p.getVersion(), p.getKey());
  8. }
  9. }
  10. }

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

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

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

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

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

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

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

  1. @Override
  2. public void stop() {
  3. Loggers.get(ServerLifecycleNotifier.class).debug("Notify " + ServerStopHandler.class.getSimpleName() + " handlers...");
  4. for (ServerStopHandler handler : stopHandlers) {
  5. handler.onServerStop(server);
  6. }
  7. }
  8. }

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

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

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

  1. private boolean hasRuleMatchFor(InputComponent component, FilterableIssue issue) {
  2. for (WildcardPattern pattern : rulePatternByComponent.get(component)) {
  3. if (pattern.match(issue.ruleKey().toString())) {
  4. LOG.debug("Issue {} ignored by exclusion pattern {}", issue, pattern);
  5. return true;
  6. }
  7. }
  8. return false;
  9. }
  10. }

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

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

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

  1. @Override
  2. public void execute(ComputationStep.Context context) {
  3. String branchUuid = treeRootHolder.getRoot().getUuid();
  4. for (ProjectIndexer indexer : indexers) {
  5. LOGGER.debug("Call {}", indexer);
  6. indexer.indexOnAnalysis(branchUuid);
  7. }
  8. }

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

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

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

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

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

  1. private IgnoreCommand loadIgnoreCommand() {
  2. try {
  3. if (!scmConfiguration.isExclusionDisabled() && scmConfiguration.provider() != null) {
  4. return scmConfiguration.provider().ignoreCommand();
  5. }
  6. } catch (UnsupportedOperationException e) {
  7. LOG.debug("File exclusion based on SCM ignore information is not available with this plugin.");
  8. }
  9. return null;
  10. }

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

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

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

  1. @Override
  2. public void execute(SensorContext context) {
  3. Set<String> reportPaths = loadReportPaths();
  4. for (String reportPath : reportPaths) {
  5. LOG.debug("Importing issues from '{}'", reportPath);
  6. Path reportFilePath = context.fileSystem().resolvePath(reportPath).toPath();
  7. ReportParser parser = new ReportParser(reportFilePath);
  8. Report report = parser.parse();
  9. ExternalIssueImporter issueImporter = new ExternalIssueImporter(context, report);
  10. issueImporter.execute();
  11. }
  12. }

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

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

相关文章