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(Level.FINE, () -> "Failed to process " + processing + ": " + backtrace);
        }
    }
Processes a single Processing, and fails the message if this processing fails.

@param executor the DocprocService to use for processing
docproc/src/main/java/com/yahoo/docproc/jdisc/DocumentProcessingTask.java