net.roboconf.core.utils.Utils.logException()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(162)

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

Utils.logException介绍

[英]Logs an exception with the given logger and the FINEST level.
[中]使用给定的记录器和最高级记录异常。

代码示例

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Logs an exception with the given logger and the FINEST level.
 * @param logger the logger
 * @param t an exception or a throwable
 */
public static void logException( Logger logger, Throwable t ) {
  logException( logger, Level.FINEST, t );
}

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Logs an exception with the given logger and the given level.
 * <p>
 * Writing a stack trace may be time-consuming in some environments.
 * To prevent useless computing, this method checks the current log level
 * before trying to log anything.
 * </p>
 *
 * @param logger the logger
 * @param t an exception or a throwable
 * @param logLevel the log level (see {@link Level})
 */
public static void logException( Logger logger, Level logLevel, Throwable t ) {
  logException( logger, logLevel, t, null );
}

代码示例来源:origin: net.roboconf/roboconf-dm

/**
 * Closes a connection to a database.
 * @param conn
 */
void closeConnection( Connection conn ) {
  try {
    if( conn != null )
      conn.close();
  } catch( SQLException e ) {
    // Not important.
    Utils.logException( this.logger, e );
  }
}

代码示例来源:origin: net.roboconf/roboconf-dm

/**
 * Closes a statement.
 * @param st
 */
void closeStatement( Statement st ) {
  try {
    if( st != null )
      st.close();
  } catch( SQLException e ) {
    // Not important.
    Utils.logException( this.logger, e );
  }
}

代码示例来源:origin: net.roboconf/roboconf-dm

/**
 * Closes a prepared statement.
 * @param ps
 */
void closeStatement( PreparedStatement ps ) {
  try {
    if( ps != null )
      ps.close();
  } catch( SQLException e ) {
    // Not important.
    Utils.logException( this.logger, e );
  }
}

代码示例来源:origin: net.roboconf/roboconf-dm

/**
 * Closes a result set.
 * @param st
 */
void closeResultSet( ResultSet resultSet ) {
  try {
    if( resultSet != null )
      resultSet.close();
  } catch( SQLException e ) {
    // Not important.
    Utils.logException( this.logger, e );
  }
}

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Closes a statement.
 * @param st
 * @param logger
 */
public static void closeStatement( Statement st, Logger logger ) {
  try {
    if( st != null )
      st.close();
  } catch( SQLException e ) {
    // Not important.
    Utils.logException( logger, e );
  }
}

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Closes a connection to a database.
 * @param conn
 * @param logger
 */
public static void closeConnection( Connection conn, Logger logger ) {
  try {
    if( conn != null )
      conn.close();
  } catch( SQLException e ) {
    // Not important.
    Utils.logException( logger, e );
  }
}

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Closes a result set.
 * @param st
 * @param logger
 */
public static void closeResultSet( ResultSet resultSet, Logger logger ) {
  try {
    if( resultSet != null )
      resultSet.close();
  } catch( SQLException e ) {
    // Not important.
    Utils.logException( logger, e );
  }
}

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Closes a prepared statement.
 * @param ps
 * @param logger
 */
public static void closeStatement( PreparedStatement ps, Logger logger ) {
  try {
    if( ps != null )
      ps.close();
  } catch( SQLException e ) {
    // Not important.
    Utils.logException( logger, e );
  }
}

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Constructor.
 * @param propertiesFileContent
 */
public TargetValidator( String propertiesFileContent ) {
  this.props = new Properties();
  try {
    this.props.load( new ByteArrayInputStream( propertiesFileContent.getBytes( StandardCharsets.UTF_8 )));
  } catch( Exception e ) {
    this.failed = true;
    Utils.logException( this.logger, e );
  }
}

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Deletes files recursively and remains quiet even if an exception is thrown.
 * @param files the files to delete
 */
public static void deleteFilesRecursivelyAndQuietly( File... files ) {
  try {
    deleteFilesRecursively( files );
  } catch( IOException e ) {
    Logger logger = Logger.getLogger( Utils.class.getName());
    logException( logger, e );
  }
}

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Constructor.
 * @param propertiesFile
 */
public TargetValidator( File propertiesFile ) {
  try {
    this.props = Utils.readPropertiesFile( propertiesFile );
    this.fileName = propertiesFile.getName();
  } catch( Exception e ) {
    this.failed = true;
    Utils.logException( this.logger, e );
  }
}

代码示例来源:origin: net.roboconf/roboconf-target-api

/**
   * Closes the configurator.
   * @param machineId
   * @param handler
   */
  private void closeConfigurator( String machineId, MachineConfigurator handler ) {
    try {
      this.logger.fine( "Closing the configurator for machine " + machineId );
      handler.close();
    } catch( Exception e ) {
      this.logger.warning( "An error occurred while closing the configurator for machine '" + machineId + "'. " + e.getMessage());
      Utils.logException( this.logger, e );
    }
  }
}

代码示例来源:origin: net.roboconf/roboconf-dm

/**
   * Unregisters targets.
   * @param newTargetIds a non-null set of target IDs
   */
  private void unregisterTargets( Set<String> newTargetIds ) {

    for( String targetId : newTargetIds ) {
      try {
        this.targetsMngr.deleteTarget( targetId );

      } catch( Exception e ) {
        this.logger.severe( "A target ID that has just been registered could not be created. That's weird." );
        Utils.logException( this.logger, e );
      }
    }
  }
}

代码示例来源:origin: net.roboconf/roboconf-dm

/**
 * Constructor.
 */
public ConfigurationMngrImpl() {
  String karafData = System.getProperty( Constants.KARAF_DATA );
  if( Utils.isEmptyOrWhitespaces( karafData ))
    this.workingDirectory = new File( System.getProperty( "java.io.tmpdir" ), "roboconf-dm" );
  else
    this.workingDirectory = new File( karafData, "roboconf" );
  try {
    Utils.createDirectory( this.workingDirectory );
  } catch( IOException e ) {
    this.logger.severe( "The DM's configuration directory could not be found and/or created." );
    Utils.logException( this.logger, e );
  }
}

代码示例来源:origin: net.roboconf/roboconf-dm

@Override
public void restoreTemplates() {
  File configurationDirectory = this.configurationMngr.getWorkingDirectory();
  this.logger.info( "Restoring application templates from " + configurationDirectory + "..." );
  this.templates.clear();
  File templatesDirectory = new File( configurationDirectory, ConfigurationUtils.TEMPLATES );
  for( File dir : Utils.listDirectories( templatesDirectory )) {
    try {
      loadApplicationTemplate( dir );
    } catch( AlreadyExistingException | InvalidApplicationException | UnauthorizedActionException | IOException e ) {
      this.logger.warning( "Cannot restore application template in " + dir + " (" + e.getClass().getSimpleName() + ")." );
      Utils.logException( this.logger, e );
    }
  }
  this.logger.info( "Application templates restoration from " + configurationDirectory + " has just completed." );
}

代码示例来源:origin: net.roboconf/roboconf-messaging-rabbitmq

@Override
public void handleDelivery( String consumerTag, Envelope envelope, BasicProperties properties, byte[] body )
throws IOException {
  try {
    Message message = SerializationUtils.deserializeObject( body );
    this.logger.finer( this.sourceName + " received a message " + message.getClass().getSimpleName()
        + " on routing key '" + envelope.getRoutingKey() + "'.");
    this.messageQueue.add( message );
  } catch( ClassNotFoundException | IOException e ) {
    this.logger.severe( this.sourceName + ": a message could not be deserialized. => " + e.getClass().getSimpleName());
    Utils.logException( this.logger, e );
    this.messageQueue.errorWhileReceivingMessage();
  }
}

代码示例来源:origin: net.roboconf/roboconf-dm

@Override
public boolean pingMessageQueue( String message ) {
  boolean sent = false;
  final MsgEcho sentMessage = new MsgEcho( message );
  try {
    this.messagingMngr.sendMessageToTheDm( sentMessage );
    sent = true;
    this.logger.fine( "Sent Echo message on debug queue. Message=" + message + ", UUID=" + sentMessage.getUuid());
  } catch( IOException e ) {
    this.logger.fine( "No Echo message was sent on debug queue. An error occurred with the messaging." );
    Utils.logException( this.logger, e );
  }
  return sent;
}

代码示例来源:origin: net.roboconf/roboconf-dm-scheduler

@Override
  public void execute( JobExecutionContext context )
  throws JobExecutionException {

    String appName = (String) context.getJobDetail().getJobDataMap().get( RoboconfScheduler.APP_NAME );
    String jobName = (String) context.getJobDetail().getJobDataMap().get( RoboconfScheduler.JOB_NAME );
    String commandsFileName = (String) context.getJobDetail().getJobDataMap().get( RoboconfScheduler.CMD_NAME );

    try {
      Manager manager = (Manager) context.getScheduler().getContext().get( RoboconfScheduler.MANAGER );
      Application app = manager.applicationMngr().findApplicationByName( appName );

      // The web console finds jobs by names, not IDs, which remain internal to Quartz
      manager.commandsMngr().execute( app, commandsFileName, CommandHistoryItem.ORIGIN_SCHEDULER, jobName );

    } catch( Exception e ) {
      this.logger.warning( "An error occurred while executing job " + jobName + " (command file =" + commandsFileName + ")." );
      Utils.logException( this.logger, e );
    }
  }
}

相关文章