public class RotatingFileAppender extends Object implements AccessLogAppender
| Constructor and Description |
|---|
RotatingFileAppender(File directory,
String filePattern)
Create a
RotatingFileAppender writing access log files in the
specified directory and using the specified SimpleDateFormat
pattern to generate file names. |
RotatingFileAppender(File directory,
String fileName,
String archivePattern)
Create a
RotatingFileAppender writing access log files in the
specified directory. |
public RotatingFileAppender(File directory, String filePattern) throws IOException
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.
directory - The directory where access log files will be written to.filePattern - A properly escaped SimpleDateFormat pattern
for the access log files.IOException - If an I/O error occurred accessing the filesystem.public RotatingFileAppender(File directory, String fileName, String archivePattern) throws IOException
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.
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.IOException - If an I/O error occurred accessing the filesystem.public void append(String accessLogEntry) throws IOException
AccessLogAppenderappend in interface AccessLogAppenderaccessLogEntry - The String value of the data to be append
in the access log.IOException - If an I/O error occurred appending to the log.public void close()
throws IOException
AccessLogAppenderclose in interface Closeableclose in interface AutoCloseableclose in interface AccessLogAppenderIOExceptionCopyright © 2014 Oracle Corporation. All Rights Reserved.