private void logFailed(Exception e) throws Exception {
		if (e instanceof VBatchException && ((VBatchException) e).logged==true) {
			
		}
		else {
			// log this error 
			this.job_manager.log.error(e.getMessage(), e);
			// Let other objects know this exception has already been logged
			if (e instanceof VBatchException) {
				((VBatchException) e).logged=true;
			}
		}	
			
		// rollback any uncomitted logs, so we don't mistakenly make
		// it look like this step completed successfully
		if (this.job_manager.db.getTransaction().isActive()) {
			this.job_manager.db.getTransaction().rollback();
			if (!(this.job_manager.db.getTransaction().isActive())) {
				this.job_manager.db.getTransaction().begin();
			}
		}
		else {
			this.job_manager.db.getTransaction().begin();
		}
		
		
		// Write out log_dtl with error status
		if (this.log_dtl == null) {
			this.log_dtl = new BatchLogDtl();
		}
		this.log_dtl.setBatchLog(this.job_manager.batch_log);
		this.log_dtl.setStartDt(new Date());
		this.log_dtl.setStatus(BatchLog.statusError);
//		this.log_dtl.setErrorMsg(e.getMessage());
		// required fields to be able to save this log_dtl
		this.log_dtl.setJobStepsXrefJobStepSeq(this.jobStepXref.getJobStepSeq());
		this.log_dtl.setStepsId(this.jobStepXref.getId());
		this.log_dtl.setStepType("Extract");
		String logfilename = this.job_manager.getJobLogFilename();
		String errormsg = " [" + logfilename + "] " + log_dtl.getErrorMsg();
	    // Limit errorMsg to 150 characters to fit in db field
		this.log_dtl.setErrorMsg(StringUtils.left(errormsg, 150));
		
		this.job_manager.db.persist(this.log_dtl);
		this.job_manager.db.getTransaction().commit();
		
		this.closeJDBCConnection();
		// Re-throw this exception so JobManager catches it
		throw e;
		
	}