Save This Page
Home » apache-log4j-1.2.15 » org.apache » log4j » [javadoc | source]
org.apache.log4j
public class: DailyFileAppender [javadoc | source]
java.lang.Object
   org.apache.log4j.AppenderSkeleton
      org.apache.log4j.WriterAppender
         org.apache.log4j.FileAppender
            org.apache.log4j.DailyFileAppender

All Implemented Interfaces:
    OptionHandler, Appender

DailyFileAppender extends FileAppender to use filenames formatted with date/time information. The filename is recomputed every day at midnight. Note that the filename doesn't have to change every day, making it possible to have logfiles which are per-week or per-month. The appender computes the proper filename using the formats specified in java.text.SimpleDateFormat. The format requires that most static text is enclosed in single quotes, which are removed. The examples below show how quotes are used to embed static information in the format. Sample filenames: Filename pattern Filename "'/logs/trace-'yyyy-MM-dd'.log'" /logs/trace-2000-12-31.log "'/logs/trace-'yyyy-ww'.log'" /logs/trace-2000-52.log
Field Summary
public static final  String FILE_NAME_PATTERN_OPTION    A string constant used in naming the option for setting the filename pattern. Current value of this string constant is FileNamePattern
Fields inherited from org.apache.log4j.FileAppender:
fileAppend,  fileName,  bufferedIO,  bufferSize
Fields inherited from org.apache.log4j.WriterAppender:
immediateFlush,  encoding,  qw
Fields inherited from org.apache.log4j.AppenderSkeleton:
layout,  name,  threshold,  errorHandler,  headFilter,  tailFilter,  closed
Constructor:
 public DailyFileAppender() 
 public DailyFileAppender(Layout layout,
    String filename) throws IOException 
    Instantiate a FileAppender and open the file designated by filename. The opened filename will become the output destination for this appender.

    The file will be appended to.

 public DailyFileAppender(Layout layout,
    String filename,
    boolean append) throws IOException 
    Instantiate a RollingFileAppender and open the file designated by filename. The opened filename will become the ouput destination for this appender.

    If the append parameter is true, the file will be appended to. Otherwise, the file desginated by filename will be truncated before being opened.

Method from org.apache.log4j.DailyFileAppender Summary:
activateOptions,   getOptionStrings,   setFile,   setOption,   subAppend
Methods from org.apache.log4j.FileAppender:
activateOptions,   closeFile,   getAppend,   getBufferSize,   getBufferedIO,   getFile,   reset,   setAppend,   setBufferSize,   setBufferedIO,   setFile,   setFile,   setQWForFiles
Methods from org.apache.log4j.WriterAppender:
activateOptions,   append,   checkEntryConditions,   close,   closeWriter,   createWriter,   getEncoding,   getImmediateFlush,   requiresLayout,   reset,   setEncoding,   setErrorHandler,   setImmediateFlush,   setWriter,   subAppend,   writeFooter,   writeHeader
Methods from org.apache.log4j.AppenderSkeleton:
activateOptions,   addFilter,   append,   clearFilters,   doAppend,   finalize,   getErrorHandler,   getFilter,   getFirstFilter,   getLayout,   getName,   getThreshold,   isAsSevereAsThreshold,   setErrorHandler,   setLayout,   setName,   setThreshold
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.log4j.DailyFileAppender Detail:
 public  void activateOptions() 
 public String[] getOptionStrings() 
 public synchronized  void setFile(String fileName,
    boolean append) throws IOException 
    Set the current output file. The function will compute a new filename, and open a new file only when the name has changed. The function is automatically called once a day, to allow for daily files -- the purpose of this class.
 public  void setOption(String key,
    String value) 
    Set the options for the appender
 protected  void subAppend(LoggingEvent event) 
    This method differentiates RollingFileAppender from its super class.