Tabnine Logo
Logger
Code IndexAdd Tabnine to your IDE (free)

How to use
Logger
in
com.speedment.common.logger

Best Java code snippets using com.speedment.common.logger.Logger (Showing top 20 results out of 315)

origin: speedment/speedment

public static Properties loadProperties(Logger logger, File configFile) {
  final Properties properties = new Properties();
  if (configFile.exists() && configFile.canRead()) {
    try (final InputStream in = new FileInputStream(configFile)) {
      properties.load(in);
    } catch (final IOException ex) {
      final String err = "Error loading default settings from "
        + configFile.getAbsolutePath() + "-file.";
      logger.error(ex, err);
      throw new RuntimeException(err, ex);
    }
  } else {
    logger.info(
      "No configuration file '"
      + configFile.getAbsolutePath() + "' found."
    );
  }
  return properties;
}

origin: speedment/speedment

private void discard(PoolableConnection connection) {
  requireNonNull(connection);
  LOGGER_CONNECTION.debug("Discard: %s", connection);
  try {
    connection.rawClose();
  } catch (SQLException sqle) {
    LOGGER_CONNECTION.error(sqle, "Error closing a connection.");
  }
}
origin: speedment/speedment

private <T> T readSilent(ResultSet rs, SqlSupplier<T> supplier, boolean fullWarning) {
  try {
    final T result = supplier.get();
    if (rs.wasNull()) {
      return null;
    } else {
      return result;
    }
  } catch (SQLException sqle) {
    // ignore, just return null
    if (fullWarning) {
      LOGGER.warn(sqle, "Unable to read column metadata: " + sqle.getMessage());
    } else {
      LOGGER.info("Metadata not supported: " + sqle.getMessage());
    }
  }
  return null;
}
origin: speedment/speedment

@Override
public <ENTITY> SqlStreamOptimizer<ENTITY> get(Pipeline initialPipeline, DbmsType dbmsType) {
  if (DEBUG.isEqualOrHigherThan(LOGGER_STREAM_OPTIMIZER.getLevel())) {
    LOGGER_STREAM_OPTIMIZER.debug("Evaluating %s pipeline: %s", initialPipeline.isParallel() ? "parallel" : "sequential", initialPipeline.toString());
  }
  final SqlStreamOptimizer<ENTITY> result = getHelper(initialPipeline, dbmsType);
  if (DEBUG.isEqualOrHigherThan(LOGGER_STREAM_OPTIMIZER.getLevel())) {
    LOGGER_STREAM_OPTIMIZER.debug("Selected: %s", result.getClass().getSimpleName());
  }
  return result;
}
origin: speedment/speedment

private void closeSilently(final AutoCloseable closeable) {
  actionSilently(closeable, AutoCloseable::close, "closing");
  try {
    if (closeable != null) {
      closeable.close();
    }
  } catch (Exception e) {
    LOGGER.error(e, "Error closing " + closeable);
    // Just log the error. No re-throw
  }
}
origin: speedment/speedment

private String readSchemaName(ResultSet rs, DbmsType dbmsType) throws SQLException {
  final String schemaName = rs.getString(dbmsType.getResultSetTableSchema());
  String catalogName = "";
  
  try {
    // This column is not there for Oracle so handle it
    // gracefully....
    catalogName = rs.getString("TABLE_CATALOG");
  } catch (final SQLException ex) {
    LOGGER.info("TABLE_CATALOG not in result set.");
  }
  
  return Optional.ofNullable(schemaName).orElse(catalogName);
}
origin: speedment/speedment

  void setMaxRetainSize(int maxRetainSize) {
    LOGGER_CONNECTION.warn("Unsafe method called. Use configuration parameters to set this value instead");
    this.maxRetainSize = maxRetainSize;
  }
}
origin: speedment/speedment

  private void debug(String action) {
    LOGGER.debug("Report node " + action);
  }
}
origin: speedment/speedment

protected void checkDatabaseConnectivity(Injector injector) {
  LOGGER.debug("Checking Database Connectivity");
  final Project project = injector.getOrThrow(ProjectComponent.class)
    .getProject();
  
  project.dbmses().forEachOrdered(dbms -> {
    final DbmsHandlerComponent dbmsHandlerComponent = injector
      .getOrThrow(DbmsHandlerComponent.class);
    
    final DbmsType dbmsType = DatabaseUtil
      .dbmsTypeOf(dbmsHandlerComponent, dbms);
    
    final DbmsMetadataHandler handler = dbmsType.getMetadataHandler();
    try {
      LOGGER.info(handler.getDbmsInfoString(dbms));
    } catch (final SQLException sqle) {
      throw new SpeedmentException("Unable to establish initial " + 
        "connection with the database named " + 
        dbms.getName() + ".", sqle);
    }
  });
}
origin: speedment/speedment

  private void blockUntilAvailable() {
    if (closed) {
      throw new IllegalStateException("This connection has already been closed.");
    }
    if (!available) {
      LOGGER_CONNECTION.debug("Aquiring connection");
      try {
        if (!lock.tryAcquire()) {
          if (blocking) {
            LOGGER_CONNECTION.warn("Waiting for connection to become available...");
            lock.acquire();
          } else {
            throw new SpeedmentException(
              "Error! No connection available. Try " +
              "wrapping the expression in a transaction or " +
              "enable the Speedment parameter " +
              "'connectionpool.blocking=true'.");
          }
        }
      } catch (final InterruptedException ex) {
        throw new SpeedmentException(
          "Interrupted while waiting for available connection.", ex);
      }
      this.counter.incrementAndGet();
      available = true;
    }
  }
}
origin: speedment/speedment

public void writeToFile(TranslatorManager delegator, Path codePath, String content, boolean overwriteExisting) {
  requireNonNulls(codePath, content);
  try {
    if (overwriteExisting || !codePath.toFile().exists()) {
      final Path hashPath = codePath.getParent()
        .resolve(secretFolderName())
        .resolve(HASH_PREFIX + codePath.getFileName().toString() + HASH_SUFFIX);
      write(hashPath, HashUtil.md5(content), true);
      write(codePath, content, false);
      fileCounter.incrementAndGet();
    }
  } catch (final IOException ex) {
    LOGGER.error(ex, "Failed to write file " + codePath);
  }
  LOGGER.trace("*** BEGIN File:" + codePath);
  Stream.of(content.split(Formatting.nl())).forEachOrdered(LOGGER::trace);
  LOGGER.trace("*** END   File:" + codePath);
}
origin: speedment/speedment

requireNonNull(stage);
InjectorBuilder.logger().setLevel(DEBUG);
  LOGGER.warn("Creating new Speedment instance for UI session.");
  INJECTOR = new DefaultApplicationBuilder(
      getClass().getClassLoader(),
origin: speedment/speedment

@Override
public void setLevel(String path, Level level) {
  requireNonNulls(path, level);
  loggers()
    .filter(e
      -> e.getKey().startsWith(path)
    )
    .map(Entry::getValue).forEach((Logger l)
    -> l.setLevel(level)
  );
}
origin: speedment/speedment

private <T> void actionSilently(final T actionTarget, ThrowingConsumer<T> action, String actionLabel) {
  try {
    if (actionTarget != null) {
      action.accept(actionTarget);
    }
  } catch (Exception e) {
    LOGGER.error(e, "Error " + actionLabel + " " + actionTarget);
    // Just log the error. No re-throw
  }
}
origin: speedment/speedment

  private <ENTITY> SqlStreamOptimizer<ENTITY> getHelper(Pipeline initialPipeline, DbmsType dbmsType) {
    @SuppressWarnings("unchecked")
    SqlStreamOptimizer<ENTITY> result = (SqlStreamOptimizer<ENTITY>) FALL_BACK;
    if (initialPipeline.isEmpty()) {
      return result;
    }

    Metrics metric = Metrics.empty();
    for (int i = optimizers.size() - 1; i >= 0; i--) {
      @SuppressWarnings("unchecked")
      final SqlStreamOptimizer<ENTITY> candidate = (SqlStreamOptimizer<ENTITY>) optimizers.get(i);
      final Metrics candidateMetric = candidate.metrics(initialPipeline, dbmsType);
      if (DEBUG.isEqualOrHigherThan(LOGGER_STREAM_OPTIMIZER.getLevel())) {
        LOGGER_STREAM_OPTIMIZER.debug("Candidate: %-30s : %s ", candidate.getClass().getSimpleName(), candidateMetric);
      }
      if (METRICS_COMPARATOR.compare(candidateMetric, metric) > 0) {
//            if (candidateMetric.getPipelineReductions() > metric.getPipelineReductions()) {
        metric = candidateMetric;
        result = candidate;
        if (metric.getPipelineReductions() == Integer.MAX_VALUE) {
          return result;
        }
      }
    }
    return result;
  }

origin: speedment/speedment

private void printStreamSupplierOrder(Injector injector) {
  injector.get(StreamSupplierComponent.class).ifPresent(root -> {
    if (root.sourceStreamSupplierComponents().findAny().isPresent()) {
      LOGGER.info("Current " + StreamSupplierComponent.class.getSimpleName() + " hierarchy:");
      printStreamSupplierOrder(root, 0);
    }
  });
}
origin: speedment/speedment

void setMaxAge(long maxAge) {
  LOGGER_CONNECTION.warn("Unsafe method called. Use configuration parameters to set this value instead");
  this.maxAge = maxAge;
}
origin: speedment/speedment

protected void logOperation(Logger logger, final String sql, final List<?> values) {
  logger.debug("%s, values:%s", sql, values);
}
origin: com.speedment.runtime/runtime-application

protected void checkDatabaseConnectivity(Injector injector) {
  LOGGER.debug("Checking Database Connectivity");
  final Project project = injector.getOrThrow(ProjectComponent.class)
    .getProject();
  
  project.dbmses().forEachOrdered(dbms -> {
    final DbmsHandlerComponent dbmsHandlerComponent = injector
      .getOrThrow(DbmsHandlerComponent.class);
    
    final DbmsType dbmsType = DatabaseUtil
      .dbmsTypeOf(dbmsHandlerComponent, dbms);
    
    final DbmsMetadataHandler handler = dbmsType.getMetadataHandler();
    try {
      LOGGER.info(handler.getDbmsInfoString(dbms));
    } catch (final SQLException sqle) {
      throw new SpeedmentException("Unable to establish initial " + 
        "connection with the database named " + 
        dbms.getName() + ".", sqle);
    }
  });
}
origin: com.speedment.runtime/runtime-core

  private void blockUntilAvailable() {
    if (closed) {
      throw new IllegalStateException("This connection has already been closed.");
    }
    if (!available) {
      LOGGER_CONNECTION.debug("Aquiring connection");
      try {
        if (!lock.tryAcquire()) {
          if (blocking) {
            LOGGER_CONNECTION.warn("Waiting for connection to become available...");
            lock.acquire();
          } else {
            throw new SpeedmentException(
              "Error! No connection available. Try " +
              "wrapping the expression in a transaction or " +
              "enable the Speedment parameter " +
              "'connectionpool.blocking=true'.");
          }
        }
      } catch (final InterruptedException ex) {
        throw new SpeedmentException(
          "Interrupted while waiting for available connection.", ex);
      }
      this.counter.incrementAndGet();
      available = true;
    }
  }
}
com.speedment.common.loggerLogger

Javadoc

Inspiration from tengi, An Open Source Project under the Apache 2 License

Most used methods

  • error
    Logs a message based on the given format and enriched with the passed arguments at level com.speedme
  • info
    Logs a message based on the given format and enriched with the passed arguments at level com.speedme
  • debug
    Logs a message based on the given format and enriched with the passed arguments at level com.speedme
  • warn
    Logs a message based on the given format and enriched with the passed arguments at level com.speedme
  • getLevel
    Returns the current log level.
  • setLevel
    Sets the current log level.
  • addListener
    Adds a LoggerEventListener to this Logger.
  • removeListener
    Removes a LoggerEventListener to this Logger if it was previously registered.
  • setFormatter
    Sets the formatter.
  • trace
    Logs a message based on the given format and enriched with the passed arguments at level com.speedme

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onRequestPermissionsResult (Fragment)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now