Class LogCleanup

java.lang.Object
io.github.jbastgen.stemma.app.io.LogCleanup

public final class LogCleanup extends Object
Removes old daily log files. Logback writes one file per day, stemma-YYYY-MM-DD.log (and stemma-ai-YYYY-MM-DD.log for the AI log); at the start of the application the files whose day is more than KEEP_DAYS days ago are deleted. Only files with exactly that name pattern are touched, so nothing else in the folder can be lost.
  • Field Details

    • KEEP_DAYS

      public static final int KEEP_DAYS
      Log files of the last 31 days are kept.
      See Also:
  • Method Details

    • deleteOlderThan

      public static List<String> deleteOlderThan(Path dir, int keepDays, LocalDate today)
      Deletes the daily log files in dir that are older than keepDays days, counted from today: with 31 days, the file of the day 31 days ago stays, the one before it goes.
      Returns:
      the names of the files that were deleted