File logbase = logfile.getParentFile();
logbase.mkdirs();
if (!logbase.isDirectory()) {
throw new ConfigException("Could not create directory: " + logbase.getAbsolutePath());
}
try {
ostream = new BufferedOutputStream(new FileOutputStream(logfile), 8192);
} catch (FileNotFoundException e) {
throw new ConfigException(e);
}
generator.getSession().setOutputStream(ostream);
}