use of org.apache.derby.shared.common.error.ErrorStringBuilder in project derby by apache.
the class Util method logError.
private static void logError(String errorMessage, Throwable t) {
HeaderPrintWriter errorStream = Monitor.getStream();
if (errorStream == null) {
t.printStackTrace();
return;
}
ErrorStringBuilder errorStringBuilder = new ErrorStringBuilder(errorStream.getHeader());
errorStringBuilder.append(errorMessage);
errorStringBuilder.stackTrace(t);
errorStream.print(errorStringBuilder.get().toString());
errorStream.flush();
errorStringBuilder.reset();
}
use of org.apache.derby.shared.common.error.ErrorStringBuilder in project derby by apache.
the class LogToFile method printErrorStack.
/**
* print stack trace from the Throwable including
* its nested exceptions
* @param t trace starts from this error
*/
private void printErrorStack(Throwable t) {
ErrorStringBuilder esb = new ErrorStringBuilder(Monitor.getStream().getHeader());
esb.stackTrace(t);
Monitor.logMessage(esb.get().toString());
esb.reset();
}
use of org.apache.derby.shared.common.error.ErrorStringBuilder in project derby by apache.
the class ReplicationLogger method logError.
/**
* 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);
}
}
use of org.apache.derby.shared.common.error.ErrorStringBuilder in project derby by apache.
the class BaseMonitor method reportException.
protected void reportException(Throwable t) {
PrintWriterGetHeader pwgh = null;
if (systemStreams != null)
pwgh = systemStreams.stream().getHeader();
ErrorStringBuilder esb = new ErrorStringBuilder(pwgh);
esb.appendln(t.getMessage());
esb.stackTrace(t);
report(esb.get().toString());
}
Aggregations