private void generateLogs() throws FileNotFoundException, IOException {
		BufferedWriter writer = null;
		if (outFile.getName().endsWith(".gz"))
			writer = newGzipBufferedWriter(outFile, Charset.forName("utf-8"));
		else {
			if (!options.isDaemon)
				writer = Files.newBufferedWriter(outFile.toPath(), Charset.forName("utf-8"));
			else {
				if (outFile.exists())
					writer = Files.newBufferedWriter(outFile.toPath(), Charset.forName("utf-8"), StandardOpenOption.APPEND);
				else
					writer = Files.newBufferedWriter(outFile.toPath(), Charset.forName("utf-8"));
			}
		}

		long expectedSize = this.size;
		long totalSize = 0;
		long logcnt = 0;

		long current, started;
		long lastLogged = started = current = System.currentTimeMillis();
		long lastLogcnt = 0;

		while (totalSize < expectedSize) {
			LogFormat log = logSelector.sample();

			try {
				String slog = log.format(logcnt, generators, null);

				slog = slog.endsWith("\n") ? slog : slog + "\n";
				writer.write(slog);
				totalSize += slog.length();
				logcnt++;
				current = System.currentTimeMillis();
				if (current - lastLogged > 1000) {
					int rate = (int) (((double) logcnt - lastLogcnt) / (current - lastLogged) * 1000.0);
					System.out.println(rate + " logs/sec");
					lastLogcnt = logcnt;
					lastLogged = current;
					writer.flush();
				}
			} catch (DateOverflowException e) {
				break;
			}
		}
		current = System.currentTimeMillis();
		System.out.println(logcnt + " log(s) generated.");
		int rate = (int) (((double) logcnt) / (current - started) * 1000.0);
		System.out.printf("%f secs. %d logs/sec\n", (current - started) / 1000.0, rate);

		writer.close();
	}