protected void writeToHBase(Event event) {
   try {
     Throwable throwable = event.getThrowable();
     String exceptionMessage = null;
     String exceptionStacktrace = null;
     if (throwable != null) {
       exceptionMessage = throwable.getMessage();
       exceptionStacktrace = getStackTrace(throwable);
     }
     if (!connection.isClosed()) {
       String email = event.getUserEmail() != null ? event.getUserEmail().getAddress() : null;
       preparedLogEventStatement.setTime(1, new Time(event.getTime().getTime()));
       preparedLogEventStatement.setString(2, event.getComponent());
       preparedLogEventStatement.setLong(3, event.getEventId());
       preparedLogEventStatement.setString(4, server);
       preparedLogEventStatement.setString(5, event.getType().name());
       preparedLogEventStatement.setString(6, event.getSeverity().name());
       preparedLogEventStatement.setString(7, event.getMessage());
       preparedLogEventStatement.setString(8, email);
       preparedLogEventStatement.setLong(9, event.getUserId());
       preparedLogEventStatement.setString(10, event.getClientHostname());
       preparedLogEventStatement.setString(11, exceptionMessage);
       preparedLogEventStatement.setString(12, exceptionStacktrace);
       preparedLogEventStatement.execute();
       connection.commit();
     } else {
       throw new IllegalStateException("Connection to HBase was closed already!");
     }
   } catch (SQLException e) {
     throw new RuntimeException("Could not insert event into event log.", e);
   }
 }
 protected void writeToLogger(Event event) {
   String message =
       "=====| "
           + event.getSeverity()
           + " event: "
           + event.getMessage()
           + " (time="
           + event.getTime()
           + ";type="
           + event.getType()
           + ") |=====";
   Throwable throwable = event.getThrowable();
   switch (event.getSeverity()) {
     case INFO:
       logger.info(message);
       break;
     case WARNING:
       if (throwable == null) {
         logger.warn(message);
       } else {
         logger.warn(message, throwable);
       }
       break;
     case ERROR:
     case FATAL:
       logger.error(message, throwable);
       break;
   }
 }