public class ArchiveLogAppender
extends org.apache.log4j.WriterAppender
This appender supports a fairly sophisticated rotation scheme. It is assumed that logs may stretch over days and megabytes, and we may want to maintain some number of previous logs.
Logs are stored in files with names representing date and time down to the second - e.g. 2006.07.24-12.33.22.log, 2006.07.24-14.58.10.log, etc. They are rolled over each day and also whenever they exceed the given bytesize (default 10M).
Logs from the same run are stored in their own directory, which is also timestamped - e.g. logs/archives/2006.07.24-14.38.06/. The timestamp is primarily to provide a somewhat intelligible unique ID, and represents the time at which the program was started.
When the appender is started, it first performs some clean-up chores. It scans the logs/archive directory and deletes the oldest run directories until there are 8 or fewer runs.
Copyright 2006 Partner Software, Inc.
| Constructor and Description |
|---|
ArchiveLogAppender() |
| Modifier and Type | Method and Description |
|---|---|
void |
activateOptions() |
protected void |
subAppend(org.apache.log4j.spi.LoggingEvent event) |
append, checkEntryConditions, close, closeWriter, createWriter, getEncoding, getImmediateFlush, requiresLayout, reset, setEncoding, setErrorHandler, setImmediateFlush, setWriter, writeFooter, writeHeaderpublic void activateOptions()
activateOptions in interface org.apache.log4j.spi.OptionHandleractivateOptions in class org.apache.log4j.WriterAppenderprotected void subAppend(org.apache.log4j.spi.LoggingEvent event)
subAppend in class org.apache.log4j.WriterAppender