/** * Creates a rotating file logger that logs the messages to files in the default directory. * * @throws FileNotFoundException if the current file cannot be opened or created. */ protected RotatingFileLogger() throws FileNotFoundException { super(getCurrentFile()); this.currentDate = new Date(); Files.directory.register((configuration, oldFile, newFile) -> rotate()); }
@Impure @Override @SuppressWarnings("deprecation") protected void log(@Nonnull Level level, @Nonnull String caller, @Nonnull String thread, @Nonnull String message, @Nullable Throwable throwable) { final Date date = new Date(); if (date.getDate() != this.currentDate.getDate()) { rotate(); } super.log(level, caller, thread, message, throwable); }