PrintWriter writer = new PrintWriter(out, false);
writer.println(DATE_FORMAT.format(date)+" - "+action+" - "+username);
writer.flush();
writer.close();
if(lock.isValid()) {
lock.release();
}
} catch (IOException e) {
throw new RuntimeException("Unable to write to authentication log file", e);
}
}