Package hudson.tasks

Class LogRotator

All Implemented Interfaces:
ExtensionPoint, Describable<BuildDiscarder>

public class LogRotator extends BuildDiscarder
Default implementation of BuildDiscarder. For historical reason, this is called LogRotator, but it does not rotate logs :-) Since 1.350 it has also the option to keep the build, but delete its recorded artifacts.
Author:
Kohsuke Kawaguchi
  • Constructor Details

    • LogRotator

      @DataBoundConstructor public LogRotator(String daysToKeepStr, String numToKeepStr, String artifactDaysToKeepStr, String artifactNumToKeepStr)
    • LogRotator

      @Deprecated public LogRotator(int daysToKeep, int numToKeep)
      Deprecated.
    • LogRotator

      public LogRotator(int daysToKeep, int numToKeep, int artifactDaysToKeep, int artifactNumToKeep)
  • Method Details

    • parse

      public static int parse(String p)
    • setRemoveLastBuild

      @DataBoundSetter public void setRemoveLastBuild(boolean removeLastBuild)
    • perform

      public void perform(Job<?,?> job) throws IOException, InterruptedException
      Description copied from class: BuildDiscarder
      Called to perform "garbage collection" on the job to discard old build records.

      Normally invoked automatically jobs when new builds occur. The general expectation is that those marked as Run.isKeepLog() will be kept untouched. To delete the build record, call Run.delete().

      Specified by:
      perform in class BuildDiscarder
      Throws:
      IOException
      InterruptedException
      See Also:
    • getDaysToKeep

      public int getDaysToKeep()
    • getNumToKeep

      public int getNumToKeep()
    • getArtifactDaysToKeep

      public int getArtifactDaysToKeep()
    • getArtifactNumToKeep

      public int getArtifactNumToKeep()
    • isRemoveLastBuild

      public boolean isRemoveLastBuild()
    • getDaysToKeepStr

      public String getDaysToKeepStr()
    • getNumToKeepStr

      public String getNumToKeepStr()
    • getArtifactDaysToKeepStr

      public String getArtifactDaysToKeepStr()
    • getArtifactNumToKeepStr

      public String getArtifactNumToKeepStr()