Class RotatingFileAppender
java.lang.Object
org.glassfish.grizzly.http.server.accesslog.RotatingFileAppender
- All Implemented Interfaces:
Closeable,AutoCloseable,AccessLogAppender
- Author:
- Pier Fumagalli, USRZ.com
-
Constructor Summary
ConstructorsConstructorDescriptionRotatingFileAppender(File directory, String filePattern) Create aRotatingFileAppenderwriting access log files in the specified directory and using the specifiedSimpleDateFormatpattern to generate file names.RotatingFileAppender(File directory, String fileName, String archivePattern) Create aRotatingFileAppenderwriting access log files in the specified directory. -
Method Summary
-
Constructor Details
-
RotatingFileAppender
Create aRotatingFileAppenderwriting access log files in the specified directory and using the specifiedSimpleDateFormatpattern 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 likeaccess-2013120422.log,access-2013120423.log, ... and so on.- Parameters:
directory- The directory where access log files will be written to.filePattern- A properly escapedSimpleDateFormatpattern for the access log files.- Throws:
IOException- If an I/O error occurred accessing the filesystem.
-
RotatingFileAppender
public RotatingFileAppender(File directory, String fileName, String archivePattern) throws IOException Create aRotatingFileAppenderwriting 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
fileNameparameter, and then archival of files will be delegated to the archive pattern.For example when
fileNameiscurrent.logandarchivePatternis'archive-'yyyyMMDD'.log'(note the quotes), access logs will be written to thecurrent.logfile and this file will be rotated on a daily basis to files likearchive-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 escapedSimpleDateFormatpattern for the access log archive files.- Throws:
IOException- If an I/O error occurred accessing the filesystem.
-
-
Method Details
-
append
Description copied from interface:AccessLogAppenderAppend the specified access log entry.- Specified by:
appendin interfaceAccessLogAppender- Parameters:
accessLogEntry- TheStringvalue of the data to be append in the access log.- Throws:
IOException- If an I/O error occurred appending to the log.
-
close
Description copied from interface:AccessLogAppenderClose any underlying resource owned by this appender.- Specified by:
closein interfaceAccessLogAppender- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-