/**
   * Print error message and the stack trace of the throwable to the log (usually derby.log)
   * provided that verbose is true. If verbose is false, nothing is logged.
   *
   * @param msgId The error message id
   * @param t Error trace starts from this error
   */
  public void logError(String msgId, Throwable t) {

    if (verbose) {

      Monitor.logTextMessage(MessageId.REPLICATION_ERROR_BEGIN, new Date());

      if (msgId != null) {
        Monitor.logTextMessage(msgId, dbname);
      }

      if (t != null) {
        ErrorStringBuilder esb = new ErrorStringBuilder(Monitor.getStream().getHeader());
        esb.stackTrace(t);
        Monitor.logMessage(esb.get().toString());
        esb.reset();
      }
      Monitor.logTextMessage(MessageId.REPLICATION_ERROR_END);
    }
  }