Request to add helper method to DailyRollingFileAppender to generate schedule file name. That way, subclasses can determine the names of the files that the appender will archive to. i.e., Change Log4j v1.2.15 from void rollOver() throws IOException { ... String datedFilename = fileName+sdf.format(now); ... } to void rollOver() throws IOException { ... String datedFilename = getScheduledFileName(now); ... } /** * Subclasses may override this to change the name * of file that logs get rotated to. * * @param date [in] (non-null) time used to tag logs being rotated out * * @return name of file [to rotate to] */ protected String getScheduledFileName(Date date) { return fileName + sdf.format(now); }
Would it be sufficient with a pattern (with an information set available on the file to be rolled out) or do you want to be able to sub class? I think there should be a number of overrideable methods to subclass to make things easier. We had a need for rolling logs, and being able to compress and rename those which would otherwise have been deleted. It was not easy to do nicely.