Class RotatingFileAppender

    • Constructor Summary

      Constructors 
      Constructor Description
      RotatingFileAppender​(java.io.File directory, java.lang.String filePattern)
      Create a RotatingFileAppender writing access log files in the specified directory and using the specified SimpleDateFormat pattern to generate file names.
      RotatingFileAppender​(java.io.File directory, java.lang.String fileName, java.lang.String archivePattern)
      Create a RotatingFileAppender writing access log files in the specified directory.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void append​(java.lang.String accessLogEntry)
      Append the specified access log entry.
      void close()
      Close any underlying resource owned by this appender.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RotatingFileAppender

        public RotatingFileAppender​(java.io.File directory,
                                    java.lang.String filePattern)
                             throws java.io.IOException
        Create a RotatingFileAppender writing access log files in the specified directory and using the specified SimpleDateFormat pattern to generate file names.

        For example when the specified pattern is 'access-'yyyyMMDDhh'.log' (note the quotes), access log files will be rotated on a hourly basis, and the output will be written to files like access-2013120422.log, access-2013120423.log, ... and so on.

        Parameters:
        directory - The directory where access log files will be written to.
        filePattern - A properly escaped SimpleDateFormat pattern for the access log files.
        Throws:
        java.io.IOException - If an I/O error occurred accessing the filesystem.
      • RotatingFileAppender

        public RotatingFileAppender​(java.io.File directory,
                                    java.lang.String fileName,
                                    java.lang.String archivePattern)
                             throws java.io.IOException
        Create a RotatingFileAppender writing access log files in the specified directory.

        When using this constructor the current log file (the one being written to) will always be the one identified by the fileName parameter, and then archival of files will be delegated to the archive pattern.

        For example when fileName is current.log and archivePattern is 'archive-'yyyyMMDD'.log' (note the quotes), access logs will be written to the current.log file and this file will be rotated on a daily basis to files like archive-20131204.log, archive-20131205.log, ... and so on.

        Parameters:
        directory - The directory where access log files will be written to.
        fileName - A file name where log entries will be written to.
        archivePattern - A properly escaped SimpleDateFormat pattern for the access log archive files.
        Throws:
        java.io.IOException - If an I/O error occurred accessing the filesystem.
    • Method Detail

      • append

        public void append​(java.lang.String accessLogEntry)
                    throws java.io.IOException
        Description copied from interface: AccessLogAppender
        Append the specified access log entry.
        Specified by:
        append in interface AccessLogAppender
        Parameters:
        accessLogEntry - The String value of the data to be append in the access log.
        Throws:
        java.io.IOException - If an I/O error occurred appending to the log.
      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: AccessLogAppender
        Close any underlying resource owned by this appender.
        Specified by:
        close in interface AccessLogAppender
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException