Class TimeRotationStrategy

  • All Implemented Interfaces:
    RotationStrategy

    public class TimeRotationStrategy
    extends Object
    implements RotationStrategy
    An implementation of RotationStrategy that writes output to file whose named is specified using a format processed using the the SimpleDateFormat class. This allows one to get standard time-based file rotation with whatever time granularity and formatting you may desire.
    Author:
    bdferris
    • Constructor Detail

      • TimeRotationStrategy

        public TimeRotationStrategy​(String format)
    • Method Detail

      • getNextWriter

        public Writer getNextWriter​(Writer writer,
                                    int charactersWritten)
                             throws IOException
        Description copied from interface: RotationStrategy
        Called to get the next output writer when a call is made to RotationWriter.flush(). The current writer is provided as a parameter, so if no rotation should occur, just return the current writer.
        Specified by:
        getNextWriter in interface RotationStrategy
        Parameters:
        writer - the current output writer
        charactersWritten - the number of characters written to the current writer
        Returns:
        the writer to output to in the future
        Throws:
        IOException