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

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

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

  1. private void startup() {
  2. LOG.info("Compute Engine starting up...");
  3. computeEngine.startup();
  4. LOG.info("Compute Engine is operational");
  5. }

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

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

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

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

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

  1. @Override
  2. public boolean apply(@Nonnull String pluginKey) {
  3. if (BUILDBREAKER_PLUGIN_KEY.equals(pluginKey) && mode.isPreview()) {
  4. LOG.info("Build Breaker plugin is no more supported in preview mode");
  5. return false;
  6. }
  7. if (whites.isEmpty()) {
  8. return blacks.isEmpty() || !blacks.contains(pluginKey);
  9. }
  10. return whites.contains(pluginKey);
  11. }

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

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

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

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

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

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

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

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

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

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

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

  1. private void attemptShutdown() {
  2. try {
  3. LOG.info("Compute Engine is stopping...");
  4. computeEngine.shutdown();
  5. LOG.info("Compute Engine is stopped");
  6. } catch (Throwable e) {
  7. LOG.error("Compute Engine failed to stop", e);
  8. } finally {
  9. // release thread waiting for CeServer
  10. stopAwait();
  11. }
  12. }

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

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

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

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

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

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

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

  1. private static void execute(Context context, String tableName, String sql) throws SQLException {
  2. LOG.info("Deleting orphans from " + tableName);
  3. context
  4. .prepareUpsert(sql)
  5. .execute()
  6. .commit();
  7. }
  8. }

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

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

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

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

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

  1. public void execute() {
  2. String taskId = null;
  3. File report = generateReportFile();
  4. if (properties.shouldKeepReport()) {
  5. LOG.info("Analysis report generated in " + reportDir);
  6. }
  7. if (!analysisMode.isMediumTest()) {
  8. taskId = upload(report);
  9. }
  10. logSuccess(taskId);
  11. }

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

  1. public void clearIndexes() {
  2. Loggers.get(getClass()).info("Truncate Elasticsearch indices");
  3. try {
  4. esClient.prepareClearCache().get();
  5. for (String index : esClient.prepareState().get().getState().getMetaData().getConcreteAllIndices()) {
  6. clearIndex(new IndexType(index, index));
  7. }
  8. } catch (Exception e) {
  9. throw new IllegalStateException("Unable to clear indexes", e);
  10. }
  11. }

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

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

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

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

相关文章