public void preprocess(Run run) { File logFile = new File(getRunDir(run), "genetik.log"); try { SimpleFileHandler fh = new SimpleFileHandler(logFile); fh.setFormatter(new CompactFormatter()); Logger logger = Logger.getLogger(GenetikConstants.LOGGER); logger.setLevel(Level.INFO); logger.setUseParentHandlers(false); Handler handlers[] = logger.getHandlers(); logger.addHandler(fh); for (Handler h : handlers) { logger.removeHandler(h); if (h instanceof SimpleFileHandler) h.close(); // close our old one } } catch (Exception exp) { throw new IllegalArgumentException( "Unable to create log file at " + logFile.getAbsolutePath()); } super.preprocess(run); }
@Override public void execute(Properties props) { super.execute(props); HashMap<String, Object> jsonObj = new HashMap<String, Object>(); for (Object k : props.keySet()) { String key = (String) k; String value = props.getProperty(key); jsonObj.put(key, value); } try { File runFile = new File(root, "run.json"); JSONEncoder encoder = new JSONEncoder(); BufferedWriter writer = new BufferedWriter(new FileWriter(runFile)); encoder.encode(jsonObj, writer); writer.close(); } catch (Exception exp) { throw new IllegalArgumentException("Unable to save run properties in root folder."); } }
public void postprocess() { super.postprocess(); ReportingSupport.saveReportingFiles(getProperties(), root); }