public class SaveLogsOperation implements SaveOperation {
private static final long serialVersionUID = 1L;
public void save(ProcessInstance processInstance, JbpmContext jbpmContext) {
LoggingService loggingService = jbpmContext.getServices().getLoggingService();
if (loggingService!=null) {
LoggingInstance loggingInstance = processInstance.getLoggingInstance();
log.debug("flushing logs to logging service.");
Iterator iter = loggingInstance.getLogs().iterator();
while (iter.hasNext()) {
ProcessLog processLog = (ProcessLog) iter.next();
loggingService.log(processLog);
}
} else {
log.debug("ignoring logs. no logging service available.");
}