congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Logger.error
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: speedment/speedment

protected void finallyClose(Runnable r) {
  try {
    r.run();
  } catch (Exception e) {
    LOGGER.error(e);
    throw e;
  } finally {
    close();
  }
}
origin: speedment/speedment

private void commitSilently(ConnectionInfo connectionInfo) {
  try {
    if (connectionInfo != null) {
      connectionInfo.ifNotInTransaction(c -> c.setAutoCommit(true));
    }
  } catch (SQLException e) {
    LOGGER.error(e, "Failed to commit connection upon close");
  }
}
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 <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

protected boolean finallyCloseBoolean(BooleanSupplier bs) {
  try {
    return bs.getAsBoolean();
  } catch (Exception e) {
    LOGGER.error(e);
    throw e;
  } finally {
    close();
  }
}
origin: speedment/speedment

protected <T> T finallyCloseReference(Supplier<T> s) {
  try {
    return s.get();
  } catch (Exception e) {
    LOGGER.error(e);
    throw e;
  } finally {
    close();
  }
}
origin: speedment/speedment

protected void executeInTransaction(
  final Dbms dbms,
  final Connection conn,
  final List<? extends SqlStatement> sqlStatementList
) throws SQLException {
  requireNonNull(dbms);
  requireNonNull(conn);
  requireNonNull(sqlStatementList);
  assertNotClosed();
  final AtomicReference<SqlStatement> lastSqlStatement = new AtomicReference<>();
  try {
    executeSqlStatementList(sqlStatementList, lastSqlStatement, dbms, conn);
    postSuccessfulTransaction(sqlStatementList);
  } catch (SQLException sqlEx) {
    LOGGER.error("SqlStatementList: " + sqlStatementList);
    LOGGER.error("SQL: " + lastSqlStatement);
    LOGGER.error(sqlEx, sqlEx.getMessage());
    throw sqlEx;
  }
}
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 boolean isValidOrNull(PoolableConnection connection) {
  // connection nullable
  try {
    return connection == null || (connection.getExpires() > System.currentTimeMillis() && !connection.isClosed());
  } catch (SQLException sqle) {
    LOGGER_CONNECTION.error(sqle, "Error while checking if a connection is closed.");
    return false;
  }
}
origin: speedment/speedment

  "' in class '" + value.getClass().getName() +
  "' of type '" + field.getType() + "'.";
LOGGER_INSTANCE.error(ex, err);
throw new RuntimeException(err, ex);
origin: speedment/speedment

protected long finallyCloseLong(LongSupplier lp) {
  try {
    return lp.getAsLong();
  } catch (Exception e) {
    LOGGER.error(e);
    throw e;
  } finally {
    close();
  }
}
origin: speedment/speedment

protected int finallyCloseInt(IntSupplier is) {
  try {
    return is.getAsInt();
  } catch (Exception e) {
    LOGGER.error(e);
    throw e;
  } finally {
    close();
  }
}
origin: speedment/speedment

protected double finallyCloseDouble(DoubleSupplier ds) {
  try {
    return ds.getAsDouble();
  } catch (Exception e) {
    LOGGER.error(e);
    throw e;
  } finally {
    close();
  }
}
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

@Override
public Connection newConnection(
  final String uri,
  final String username,
  final char[] password
) {
  try {
    final Connection connection = DriverManager.getConnection(uri, username, charsToString(password));
    LOGGER_CONNECTION.debug("New external connection: %s", connection);
    return connection;
  } catch (final SQLException ex) {
    final String msg = "Unable to get connection using url \"" + uri
      + "\", user = \"" + username
      + "\", password = \"********\".";
    LOGGER_CONNECTION.error(ex, msg);
    throw new SpeedmentException(msg, ex);
  }
}
origin: speedment/speedment

@Override
public void execute(Speedment speedment) throws MojoExecutionException, MojoFailureException {
  getLog().info("Generating code using JSON configuration file: '" + configLocation().toAbsolutePath() + "'.");
  
  if (hasConfigFile()) {
    try {
      final Project project = speedment.getOrThrow(ProjectComponent.class).getProject();
      speedment.getOrThrow(TranslatorManager.class).accept(project);
      // after generating the speedment code, the package location needs to be added as a source folder
      if (!mavenProject.getCompileSourceRoots().contains(mavenProject.getBasedir().getAbsolutePath() + "/" + project.getPackageLocation())) {
        System.out.println("adding new source location");
        mavenProject.addCompileSourceRoot(mavenProject.getBasedir().getAbsolutePath() + "/" + project.getPackageLocation());
      }
    } catch (final Exception ex) {
      final String err = "Error parsing configFile file.";
      LOGGER.error(ex, err);
      getLog().error(err);
      throw new MojoExecutionException(err, ex);
    }
  } else {
    final String err = "To run speedment:generate a valid configFile needs to be specified.";
    getLog().error(err);
    throw new MojoExecutionException(err);
  }
}

origin: speedment/speedment

@Override
public void newProject() {
  try {
    MainApp.setInjector(injector.newBuilder().build());
    final MainApp app    = new MainApp();
    final Stage newStage = new Stage();
    app.start(newStage);
  } catch (final Exception e) {
    LOGGER.error(e);
    showError("Could not create empty project", e.getMessage(), e);
  }
}
origin: speedment/speedment

protected void validateRuntimeConfig(Injector injector) {
  LOGGER.debug("Validating Runtime Configuration");
  final Project project = injector.getOrThrow(ProjectComponent.class)
    .getProject();
  
  if (project == null) {
    throw new SpeedmentException("No project defined");
  }
  project.dbmses().forEach(d -> {
    final String typeName = d.getTypeName();
    final Optional<DbmsType> oDbmsType = injector.getOrThrow(
      DbmsHandlerComponent.class).findByName(typeName);
    
    if (!oDbmsType.isPresent()) {
      throw new SpeedmentException("The database type " + typeName + 
        " is not registered with the " + 
        DbmsHandlerComponent.class.getSimpleName());
    }
    final DbmsType dbmsType = oDbmsType.get();
    
    if (!dbmsType.isSupported()) {
      LOGGER.error("The database driver class " + dbmsType.getDriverName() + 
        " is not available. Make sure to include it in your " + 
        "class path (e.g. in the POM file)"
      );
    }
  });
}
origin: speedment/speedment

/**
 * Retrieves data about he window settings from the previous session and applies 
 * them to the stage. These settings include window size, position and if
 * it was maximized or not.
 * 
 * @param stage  the stage to apply these settings to
 * @param name   the name under which we stored the settings
 */
public static void applyStoredDisplaySettings(Stage stage, String name){
  try {
    if( PREFERENCES.nodeExists(name) ){
      Preferences stagePreferences = PREFERENCES.node(name);
      boolean wasMaximized = stagePreferences.getBoolean(WINDOW_MAXIMIZED, false);
      if( wasMaximized ){
        stage.setMaximized(true);
      } else {
        stage.setX( stagePreferences.getDouble(WINDOW_X_POS, DEFUALT_X));
        stage.setY( stagePreferences.getDouble(WINDOW_Y_POS, DEFUALT_Y));
        stage.setWidth( stagePreferences.getDouble(WINDOW_WIDTH,  DEFUALT_WIDTH));
        stage.setHeight(stagePreferences.getDouble(WINDOW_HEIGHT, DEFUALT_HEIHGT));
      }                
    }
  } catch (BackingStoreException ex) {
    LOGGER.error(ex, "Could not access preferences for window " + name);
  }
}

com.speedment.common.loggerLoggererror

Javadoc

Logs a message at level com.speedment.common.logger.Level#ERROR.

Popular methods of Logger

  • 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

  • Start an intent from android
  • getApplicationContext (Context)
  • getExternalFilesDir (Context)
  • getResourceAsStream (ClassLoader)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • JLabel (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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