public class EnhancedDailyRollingFileAppender
extends org.apache.log4j.FileAppender
archiveDirectory
property. The default value is
archive
Note that since DailyRollingFileAppender is not easily extendible, this class is
actually a copy and paste of all the code with slights modifications...Constructor and Description |
---|
EnhancedDailyRollingFileAppender()
The default constructor does nothing.
|
EnhancedDailyRollingFileAppender(org.apache.log4j.Layout layout,
String filename,
String datePattern)
Instantiate a
DailyRollingFileAppender and open the file designated by filename . |
Modifier and Type | Method and Description |
---|---|
void |
activateOptions() |
String |
getDatePattern()
Returns the value of the DatePattern option.
|
void |
setArchiveDirectory(String archiveDirectory)
Sets the archiveDirectory.
|
void |
setDatePattern(String pattern)
The DatePattern takes a string in the same format as expected by
SimpleDateFormat . |
protected void |
subAppend(org.apache.log4j.spi.LoggingEvent event)
This method differentiates DailyRollingFileAppender from its super class.
|
closeFile, getAppend, getBufferedIO, getBufferSize, getFile, reset, setAppend, setBufferedIO, setBufferSize, setFile, setFile, setQWForFiles
append, checkEntryConditions, close, closeWriter, createWriter, getEncoding, getImmediateFlush, requiresLayout, setEncoding, setErrorHandler, setImmediateFlush, setWriter, shouldFlush, writeFooter, writeHeader
public EnhancedDailyRollingFileAppender()
public EnhancedDailyRollingFileAppender(org.apache.log4j.Layout layout, String filename, String datePattern) throws IOException
DailyRollingFileAppender
and open the file designated by filename
.
The opened filename will become the ouput destination for this appender.IOException
public void setArchiveDirectory(String archiveDirectory)
archiveDirectory
- the archiveDirectory to setpublic void setDatePattern(String pattern)
SimpleDateFormat
. This options
determines the rollover schedule.public String getDatePattern()
public void activateOptions()
activateOptions
in interface org.apache.log4j.spi.OptionHandler
activateOptions
in class org.apache.log4j.FileAppender
protected void subAppend(org.apache.log4j.spi.LoggingEvent event)
Before actually logging, this method will check whether it is time to do a rollover. If it is, it will schedule the next rollover time and then rollover.
subAppend
in class org.apache.log4j.WriterAppender
Copyright © 2005–2019. All rights reserved.