I am trying to check if a log file is empty (meaning no errors) or not, in Java, on Windows. I have tried using 2 methods so far.
Method 1 (Failure)
Another way to do this is (using Apache Commons FileUtils) -
Apache Commons
FileUtils
private void printEmptyFileName(final File file) throws IOException { if (FileUtils.readFileToString(file).trim().isEmpty()) { System.out.println("File is empty: " + file.getName()); } }