I got this method for creating a log file:
public static void write(String path, String content) {
try {
FileWriter fw = new FileWriter(path, true);
PrintWriter buffWrite = new PrintWriter(fw);
String row = "";
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String now = dateFormat.format(new Date(System.currentTimeMillis()));
row = "["+ now + "]\n" + content;
buffWrite.println(row);
buffWrite.close();
} catch (IOException e) {
e.printStackTrace();
}
}
but the file is not created, instead I get this error:
java.io.FileNotFoundException: src/main/resources/templates/log/email.log (No such file or directory)
Whats the fix for this?