APISonar


sf.util.SchemaCrawlerLogger.log

> sf > util > SchemaCrawlerLogger > log
sf APIs util APIs SchemaCrawlerLogger APIs log APIs

Example 1
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(StateUtility.class.getName());

  private static void log(final Level level,
                          final Supplier<String> toLog,
                          final boolean showlog)
  {
    if (showlog)
    {
      System.out.println(toLog.get());
    }
    else
    {
      LOGGER.log(level, toLog);
    }
  }
Example 2
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger.getLogger(
    CommandLineLoggingUtility.class.getName());

  public static void logSystemClasspath()
  {
    if (!LOGGER.isLoggable(Level.CONFIG))
    {
      return;
    }

    LOGGER.log(Level.CONFIG,
               String.format("Classpath: %n%s",
                             printPath(System.getProperty("java.class.path"))));
    LOGGER.log(Level.CONFIG,
               String.format("LD_LIBRARY_PATH: %n%s",
                             printPath(System.getenv("LD_LIBRARY_PATH"))));
  }
Example 3
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger.getLogger(
    CommandLineLoggingUtility.class.getName());

  public static void logFullStackTrace(final Level level, final Throwable t)
  {
    if (level == null || !LOGGER.isLoggable(level))
    {
      return;
    }
    if (t == null)
    {
      return;
    }

    LOGGER.log(level, t.getMessage(), t);
  }
Example 4
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(InfoLevel.class.getName());

  public static InfoLevel valueOfFromString(final String infoLevelValue)
  {
    try
    {
      return InfoLevel.valueOf(infoLevelValue);
    }
    catch (final IllegalArgumentException | NullPointerException e)
    {
      LOGGER.log(Level.INFO,
                 new StringFormat("Unknown infolevel <%s>", infoLevelValue));
      return unknown;
    }
  }
Example 5
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger.getLogger(
    BaseCommandChain.class.getName());

  final void executeChain()
    throws Exception
  {
    if (scCommands.isEmpty())
    {
      LOGGER.log(Level.INFO, "No command to execute");
      return;
    }

    for (final SchemaCrawlerCommand scCommand : scCommands)
    {
      scCommand.execute();
    }
  }
Example 6
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(TableExtRetriever.class.getName());

  void retrieveTableColumnPrivileges()
    throws SQLException
  {
    try (final MetadataResultSet results = new MetadataResultSet(getMetaData()
      .getColumnPrivileges(null, null, "%", "%"));)
    {
      createPrivileges(results, true);
    }
    catch (final Exception e)
    {
      LOGGER
        .log(Level.WARNING,
             "Could not retrieve table column privileges:" + e.getMessage());
    }
  }
Example 7
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger.getLogger(
    DisconnectCommand.class.getName());

  public void run()
  {
    LOGGER.log(Level.INFO, "disconnect");

    state.disconnect();
  }
Example 8
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(ReaderInputResource.class.getName());

  public Reader openNewInputReader(final Charset charset)
    throws IOException
  {
    LOGGER.log(Level.INFO, "Input to provided reader");
    return new InputReader(getDescription(), new BufferedReader(reader), false);
  }
Example 9
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(MetadataResultSet.class.getName());

  public void close()
    throws SQLException
  {
    results.close();

    if (LOGGER.isLoggable(Level.INFO) && !isBlank(description))
    {
      LOGGER.log(Level.INFO,
                 new StringFormat("Processed %d rows for <%s>",
                                  rowCount,
                                  description));
    }
  }
Example 10
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(ClasspathInputResource.class.getName());

  public ClasspathInputResource(final String classpathResource)
    throws IOException
  {
    this.classpathResource = requireNonNull(classpathResource,
                                            "No classpath resource provided");
    if (ClasspathInputResource.class
      .getResource(this.classpathResource) == null)
    {
      final IOException e = new IOException("Cannot read classpath resource, "
                                            + this.classpathResource);
      LOGGER.log(Level.FINE, e.getMessage(), e);
      throw e;
    }
  }
Example 11
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(EmbeddedSQLiteWrapper.class.getName());

  protected final Path checkDatabaseFile(final Path dbFile)
    throws IOException
  {
    final Path databaseFile = requireNonNull(dbFile,
                                             "No database file path provided")
      .normalize().toAbsolutePath();
    if (!isFileReadable(databaseFile))
    {
      final IOException e = new IOException(
        "Cannot read database file, " + databaseFile);
      LOGGER.log(Level.FINE, e.getMessage(), e);
      throw e;
    }
    return databaseFile;
  }
Example 12
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(LintReportOutputFormat.class.getName());

  public static LintReportOutputFormat fromFormat(final String format)
  {
    final LintReportOutputFormat outputFormat = fromFormatOrNull(format);
    if (outputFormat == null)
    {
      LOGGER.log(Level.CONFIG,
                 new StringFormat("Unknown format <%s>, using default",
                                  format));
      return text;
    }
    else
    {
      return outputFormat;
    }
  }
Example 13
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(QueryUtility.class.getName());

  public static Object executeForScalar(final Query query,
                                        final Connection connection)
    throws SchemaCrawlerException
  {
    requireNonNull(query, "No query provided");
    final String sql = getQuery(query);
    LOGGER.log(Level.FINE,
               new StringFormat("Executing %s: %n%s", query.getName(), sql));
    return executeSqlForScalar(connection, sql);
  }
Example 14
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(IndexColumnSortSequence.class.getName());

  public static IndexColumnSortSequence valueOfFromCode(final String code)
  {
    for (final IndexColumnSortSequence type: IndexColumnSortSequence.values())
    {
      if (type.getCode().equalsIgnoreCase(code))
      {
        return type;
      }
    }
    LOGGER.log(Level.FINE, new StringFormat("Unknown code <%s>", code));
    return unknown;
  }
Example 15
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(TableConstraintType.class.getName());

  public static TableConstraintType valueOfFromValue(final String value)
  {
    for (final TableConstraintType type: TableConstraintType.values())
    {
      if (type.getValue().equalsIgnoreCase(value))
      {
        return type;
      }
    }
    LOGGER.log(Level.FINE, new StringFormat("Unknown value <%s>", value));
    return unknown;
  }
Example 16
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(Linters.class.getName());

  private Linter newLinter(final String linterId)
  {
    final Linter linter = registry.newLinter(linterId);
    if (linter != null)
    {
      linter.setLintCollector(collector);
    }
    else
    {
      LOGGER
        .log(Level.FINE, new StringFormat("Cannot find linter <%s>", linterId));
    }
    return linter;
  }
Example 17
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(OfflineCatalogLoader.class.getName());

  private static void checkConnection(final Connection connection)
  {
    if (connection == null || !(connection instanceof OfflineConnection))
    {
      LOGGER.log(Level.SEVERE,
                 "Offline database connection not provided for the offline snapshot");
    }
  }
Example 18
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(Linters.class.getName());

  public void lint(final Catalog catalog, final Connection connection)
    throws SchemaCrawlerException
  {
    for (final Linter linter : linters)
    {
      LOGGER.log(Level.FINE,
                 new StringFormat("Linting with <%s>",
                                  linter.getLinterInstanceId()));
      linter.lint(catalog, connection);
    }
  }
Example 19
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger.getLogger(
    ConnectCommand.class.getName());

  private void loadSchemaCrawlerOptionsBuilder()
  {
    LOGGER.log(Level.FINE, () -> "Creating SchemaCrawler options builder");

    final Config config = state.getAdditionalConfiguration();
    final SchemaCrawlerOptionsBuilder schemaCrawlerOptionsBuilder = SchemaCrawlerOptionsBuilder
      .builder()
      .fromConfig(config);
    state.setSchemaCrawlerOptionsBuilder(schemaCrawlerOptionsBuilder);
  }
Example 20
private static final SchemaCrawlerLogger LOGGER = SchemaCrawlerLogger
    .getLogger(SchemaCrawlerUtility.class.getName());

  private static SchemaRetrievalOptionsBuilder buildSchemaRetrievalOptions(final Connection connection)
    throws SchemaCrawlerException
  {
    checkConnection(connection);
    final DatabaseConnectorRegistry registry =  DatabaseConnectorRegistry.getDatabaseConnectorRegistry();
    final DatabaseConnector dbConnector = registry
      .lookupDatabaseConnector(connection);
    LOGGER
      .log(Level.INFO,
           "Using database plugin for " + dbConnector.getDatabaseServerType());

    final SchemaRetrievalOptionsBuilder schemaRetrievalOptionsBuilder = dbConnector
      .getSchemaRetrievalOptionsBuilder(connection);
    return schemaRetrievalOptionsBuilder;
  }