/** * Set to a value of {@code true} if the file should be rotated before the a new file is set. The rotation only * happens if the file names are the same and the file has a {@link java.io.File#length() length} greater than 0. * * @param rotateOnBoot {@code true} to rotate on boot, otherwise {@code false} */ public void setRotateOnBoot(final boolean rotateOnBoot) { checkAccess(this); synchronized (outputLock) { this.rotateOnBoot = rotateOnBoot; } }
/** * Set the maximum backup index (the number of log files to keep around). * * @param maxBackupIndex the maximum backup index */ public void setMaxBackupIndex(final int maxBackupIndex) { checkAccess(this); synchronized (outputLock) { this.maxBackupIndex = maxBackupIndex; } }
/** * Set the rotation size, in bytes. * * @param rotateSize the number of bytes before the log is rotated */ public void setRotateSize(final long rotateSize) { checkAccess(this); synchronized (outputLock) { this.rotateSize = rotateSize; } }
/** * Sets the suffix to be appended to the file name during the file rotation. The suffix does not play a role in * determining when the file should be rotated. * <p/> * The suffix must be a string understood by the {@link java.text.SimpleDateFormat}. Optionally the suffix can end * with {@code .gz} or {@code .zip} which will compress the file on rotation. * <p/> * <p> * If the suffix ends with {@code .gz} or {@code .zip} the file will be compressed on rotation. * </p> * <p> * <b>Note:</b> The {@link #setMaxBackupIndex(int) maxBackupIndex} only takes into account files rotated with same * suffix. For example if the suffix pattern is {@code .yyyy-MM-dd} and the size rotation is reached only files * with the same date suffix will be purged. A file the day before or after will not be purged. * </p> * * @param suffix the suffix to place after the filename when the file is rotated */ public void setSuffix(final String suffix) { checkAccess(this); synchronized (outputLock) { this.suffixRotator = SuffixRotator.parse(suffix); } }