public class CustomDailyRollingFileAppender
extends org.apache.log4j.FileAppender
DailyRollingFileAppender
so most of the configuration options can be taken from the documentation on
that class.| Constructor and Description |
|---|
CustomDailyRollingFileAppender()
The default constructor does nothing.
|
CustomDailyRollingFileAppender(org.apache.log4j.Layout layout,
java.lang.String filename,
java.lang.String datePattern)
Instantiate a
DailyRollingFileAppender and open the file
designated by filename. |
| Modifier and Type | Method and Description |
|---|---|
void |
activateOptions() |
protected void |
cleanupAndRollOver()
This method checks to see if we're exceeding the number of log backups
that we are supposed to keep, and if so, deletes the offending files.
|
java.lang.String |
getCompressBackups() |
java.lang.String |
getDatePattern()
Returns the value of the DatePattern option.
|
int |
getMaxDays() |
java.lang.String |
getMaxNumberOfDays() |
void |
makePath(java.lang.String filename) |
void |
setCompressBackups(java.lang.String compressBackups) |
void |
setDatePattern(java.lang.String pattern)
The DatePattern takes a string in the same format as expected by
SimpleDateFormat. |
void |
setFile(java.lang.String filename)
Make sure the directory structure for the file exists Based on JBoss
DailyRollingFileAppender,
org.jboss.logging.appender.DailyRollingFileAppender
|
void |
setMaxNumberOfDays(java.lang.String maxNumberOfDays) |
boolean |
shouldCompress() |
protected void |
subAppend(org.apache.log4j.spi.LoggingEvent event)
This method differentiates CustomDailyRollingFileAppender from its super
class.
|
closeFile, getAppend, getBufferedIO, getBufferSize, getFile, reset, setAppend, setBufferedIO, setBufferSize, setFile, setQWForFilesappend, checkEntryConditions, close, closeWriter, createWriter, getEncoding, getImmediateFlush, requiresLayout, setEncoding, setErrorHandler, setImmediateFlush, setWriter, shouldFlush, writeFooter, writeHeaderpublic CustomDailyRollingFileAppender()
public CustomDailyRollingFileAppender(org.apache.log4j.Layout layout,
java.lang.String filename,
java.lang.String datePattern)
throws java.io.IOException
DailyRollingFileAppender and open the file
designated by filename. The opened filename will become the
output destination for this appender.layout - the layoutfilename - the file namedatePattern - the date patternjava.io.IOException - if failedpublic void setFile(java.lang.String filename)
setFile in class org.apache.log4j.FileAppenderpublic void makePath(java.lang.String filename)
public void setDatePattern(java.lang.String pattern)
SimpleDateFormat. This options determines the rollover schedule.pattern - the date pattern to setpublic java.lang.String getDatePattern()
public void activateOptions()
activateOptions in interface org.apache.log4j.spi.OptionHandleractivateOptions in class org.apache.log4j.FileAppenderprotected 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.WriterAppenderprotected void cleanupAndRollOver()
throws java.io.IOException
java.io.IOException - if rollover failedpublic java.lang.String getMaxNumberOfDays()
public int getMaxDays()
public void setMaxNumberOfDays(java.lang.String maxNumberOfDays)
public boolean shouldCompress()
public java.lang.String getCompressBackups()
public void setCompressBackups(java.lang.String compressBackups)