use of com.yahoo.docproc.HandledProcessingException in project vespa by vespa-engine.
the class DocumentProcessingTask method logProcessingFailure.
private static void logProcessingFailure(Processing processing, Exception exception) {
// LOGGING ONLY:
String errorMsg = processing + " failed at " + processing.callStack().getLastPopped();
if (exception != null) {
if (exception instanceof HandledProcessingException) {
errorMsg += ". Error message: " + exception.getMessage();
log.log(Level.WARNING, errorMsg);
log.log(Level.FINE, "Chained exception:", exception);
} else {
log.log(Level.WARNING, errorMsg, exception);
}
} else {
log.log(Level.WARNING, errorMsg);
}
// LOGGING OF STACK TRACE:
if (exception != null) {
StringWriter backtrace = new StringWriter();
exception.printStackTrace(new PrintWriter(backtrace));
log.log(LogLevel.DEBUG, "Failed to process " + processing + ": " + backtrace.toString());
}
}
Aggregations