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

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

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

Logger.info介绍

[英]Logs an INFO level message.
[中]记录信息级别的消息。

代码示例

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

private void startup() {
 LOG.info("Compute Engine starting up...");
 computeEngine.startup();
 LOG.info("Compute Engine is operational");
}

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

private static void log(String title, Collection<WildcardPattern> patterns, String ident) {
  if (!patterns.isEmpty()) {
   LOG.info("{}{} {}", ident, title, patterns.stream().map(WildcardPattern::toString).collect(Collectors.joining(", ")));
  }
 }
}

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

private void cleanOnUpgrade() {
 // we assume that pending tasks are not compatible with the new version
 // and can't be processed
 LOGGER.info("Cancel all pending tasks (due to upgrade)");
 queue.clear();
}

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

@Override
public boolean apply(@Nonnull String pluginKey) {
 if (BUILDBREAKER_PLUGIN_KEY.equals(pluginKey) && mode.isPreview()) {
  LOG.info("Build Breaker plugin is no more supported in preview mode");
  return false;
 }
 if (whites.isEmpty()) {
  return blacks.isEmpty() || !blacks.contains(pluginKey);
 }
 return whites.contains(pluginKey);
}

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

public TimeoutCeTaskInterrupter(long taskTimeoutThreshold, CeWorkerController ceWorkerController, System2 system2) {
 checkArgument(taskTimeoutThreshold >= 1, "threshold must be >= 1");
 Loggers.get(TimeoutCeTaskInterrupter.class).info("Compute Engine Task timeout enabled: {} ms", taskTimeoutThreshold);
 this.taskTimeoutThreshold = taskTimeoutThreshold;
 this.ceWorkerController = ceWorkerController;
 this.system2 = system2;
}

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

public void dump(long totalTime, Logger logger) {
 List<Entry<String, Long>> data = new ArrayList<>(durations.entrySet());
 Collections.sort(data, (o1, o2) -> o2.getValue().compareTo(o1.getValue()));
 double percent = totalTime / 100.0;
 for (Entry<String, Long> entry : truncateList(data)) {
  StringBuilder sb = new StringBuilder();
  sb.append("   o ").append(entry.getKey()).append(": ").append(TimeUtils.formatDuration(entry.getValue()))
   .append(" (").append((int) (entry.getValue() / percent)).append("%)");
  logger.info(sb.toString());
 }
}

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

@Override
public void start() {
 String scmRevision = read("/build.properties").getProperty("Implementation-Build");
 Version version = runtime.getApiVersion();
 LOG.info("SonarQube {}", Joiner.on(" / ").skipNulls().join("Server", version, scmRevision));
}

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

private void logProfiling(long start, Configuration config) {
  if (config.getBoolean(CoreProperties.PROFILING_LOG_PROPERTY).orElse(false)) {
   long duration = System.currentTimeMillis() - start;
   LOG.info("\n -------- Profiling for purge: " + TimeUtils.formatDuration(duration) + " --------\n");
   profiler.dump(duration, LOG);
   LOG.info("\n -------- End of profiling for purge --------\n");
  }
 }
}

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

public void load() {
 Set<CoreExtension> coreExtensions = serviceLoaderWrapper.load(getClass().getClassLoader());
 ensureNoDuplicateName(coreExtensions);
 coreExtensionRepository.setLoadedCoreExtensions(coreExtensions);
 if (!coreExtensions.isEmpty()) {
  LOG.info("Loaded core extensions: {}", coreExtensions.stream().map(CoreExtension::getName).collect(Collectors.joining(", ")));
 }
}

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

private void attemptShutdown() {
 try {
  LOG.info("Compute Engine is stopping...");
  computeEngine.shutdown();
  LOG.info("Compute Engine is stopped");
 } catch (Throwable e) {
  LOG.error("Compute Engine failed to stop", e);
 } finally {
  // release thread waiting for CeServer
  stopAwait();
 }
}

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

@Override
 public void execute(Context context) throws SQLException {
  List<String> tables = asList("measure_filters", "measure_filter_favourites");
  Loggers.get(getClass()).info("Removing tables {}", tables);
  context.execute(tables
   .stream()
   .flatMap(table -> new DropTableBuilder(getDialect(), table).build().stream())
   .collect(toList()));
 }
}

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

private void expectCaseSensitiveDefaultCollation(Connection connection) throws SQLException {
 LOGGER.info("Verify that database collation is case-sensitive and accent-sensitive");
 String defaultCollation = metadata.getDefaultCollation(connection);
 if (!isCollationCorrect(defaultCollation)) {
  String fixedCollation = toCaseSensitive(defaultCollation);
  throw MessageException.of(format(
   "Database collation must be case-sensitive and accent-sensitive. It is %s but should be %s.", defaultCollation, fixedCollation));
 }
}

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

/**
 * Execute command and display error and output streams in log.
 * Method {@link #execute(Command, StreamConsumer, StreamConsumer, long)} is preferable,
 * when fine-grained control of output of command required.
 * @param timeoutMilliseconds any negative value means no timeout.
 *
 * @throws CommandException
 */
public int execute(Command command, long timeoutMilliseconds) {
 LOG.info("Executing command: " + command);
 return execute(command, new DefaultConsumer(), new DefaultConsumer(), timeoutMilliseconds);
}

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

private static void execute(Context context, String tableName, String sql) throws SQLException {
  LOG.info("Deleting orphans from " + tableName);
  context
   .prepareUpsert(sql)
   .execute()
   .commit();
 }
}

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

@Override
public void handle(Request request, Response response) {
 if (!webServer.isStandalone()) {
  throw new IllegalArgumentException("Restart not allowed for cluster nodes");
 }
 userSession.checkIsSystemAdministrator();
 LOGGER.info("SonarQube restart requested by {}", userSession.getLogin());
 restartFlagHolder.set();
 processCommandWrapper.requestSQRestart();
}

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

private static void clearViewTemplateReference(Context context, String defaultOrganizationUuid) throws SQLException {
 context.prepareUpsert("update organizations set default_perm_template_view = null where uuid=?")
  .setString(1, defaultOrganizationUuid)
  .execute()
  .commit();
 Loggers.get(SupportPrivateProjectInDefaultPermissionTemplate.class)
  .info("Permission template with uuid %s referenced as default permission template for view does not exist. Reference cleared.");
}

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

public void execute() {
 String taskId = null;
 File report = generateReportFile();
 if (properties.shouldKeepReport()) {
  LOG.info("Analysis report generated in " + reportDir);
 }
 if (!analysisMode.isMediumTest()) {
  taskId = upload(report);
 }
 logSuccess(taskId);
}

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

public void clearIndexes() {
 Loggers.get(getClass()).info("Truncate Elasticsearch indices");
 try {
  esClient.prepareClearCache().get();
  for (String index : esClient.prepareState().get().getState().getMetaData().getConcreteAllIndices()) {
   clearIndex(new IndexType(index, index));
  }
 } catch (Exception e) {
  throw new IllegalStateException("Unable to clear indexes", e);
 }
}

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

private void repairCaseInsensitiveColumn(Connection connection, ColumnDef column)
 throws SQLException {
 String csCollation = toCaseSensitive(column.getCollation());
 String nullability = column.isNullable() ? "NULL" : "NOT NULL";
 String type = column.getDataType().equalsIgnoreCase(TYPE_LONGTEXT) ? TYPE_LONGTEXT : format("%s(%d)", column.getDataType(), column.getSize());
 String alterSql = format("ALTER TABLE %s MODIFY %s %s CHARACTER SET '%s' COLLATE '%s' %s",
  column.getTable(), column.getColumn(), type, column.getCharset(), csCollation, nullability);
 LOGGER.info("Changing collation of column [{}.{}] from {} to {} | sql={}", column.getTable(), column.getColumn(), column.getCollation(), csCollation, alterSql);
 getSqlExecutor().executeDdl(connection, alterSql);
}

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

private void initDataSource() throws Exception {
 // but it's correctly caught by start()
 LOG.info("Create JDBC data source for {}", properties.getProperty(JDBC_URL.getKey()), DEFAULT_URL);
 BasicDataSource basicDataSource = BasicDataSourceFactory.createDataSource(extractCommonsDbcpProperties(properties));
 datasource = new ProfiledDataSource(basicDataSource, NullConnectionInterceptor.INSTANCE);
 datasource.setConnectionInitSqls(dialect.getConnectionInitStatements());
 datasource.setValidationQuery(dialect.getValidationQuery());
 enableSqlLogging(datasource, logbackHelper.getLoggerLevel("sql") == Level.TRACE);
}

相关文章