Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-435

Feature request: auto-delete older log files

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: None
    • Labels:

      Description

      Original description:

      DefaultRolloverStrategy max attribute only applies if you have a %i in the file pattern. This request is to enhance DefaultRolloverStrategy or another appropriate component to allow a max number of files limit to apply across days/months/years when a filePattern includes a date pattern.


      One of the most requested features is to add the ability to Log4j to "clean up" older log files. This usually means deleting these files, although it could also mean moving them to a different location, or some combination of these.

      Users have different requirements for selecting the files to clean up. A common request is the ability to keep the last X number of log files. This works well if rollover is only date based but may give undesired results with size based rollover.

      Another factor to consider is that the directory containing the log files may contain the log files for multiple appenders, or even files unrelated to logging.

        Attachments

        1. SizeParser.java
          4 kB
          Robert Schaft
        2. LimitingRolloverStrategy.java
          22 kB
          Robert Schaft

          Issue Links

            Activity

              People

              • Assignee:
                remkop@yahoo.com Remko Popma
                Reporter:
                arkin Arkin Yetis
              • Votes:
                36 Vote for this issue
                Watchers:
                33 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: