I have a method that writes to a log file. If the file exists it should append to it, if not then I want it to create a new file.
if (!file.exists() &&am
try to ensure the parent directory exists with:
file.getParentFile().mkdirs()