public static void toFile(Log log, Properties properties, String comment, File file, boolean append) {
		if (file == null) {
			log.error("Can't write config to null file.");
		} else {
			FileWriter writer = null;
			try {
				writer = new FileWriter(file, append);
				if (comment != null) {
					properties.store(writer, comment);
				}
			} catch (IOException e1) {
				log.error("Can't write to config file "+file.getAbsolutePath(), e1);
			}
			try {
				if (writer != null) writer.close();
			} catch (IOException e) {
				log.warn("Failed to close config writer", e);
			}
		}
	}