public class ArchivingFileHandler extends AbstractStreamHandler
Initially, the "current log file" is created (or, if it already exists and the "append" option is true,
opened in "append" mode), and log records are written to it. When it is time to "archive" the current log file,
then it is closed, renamed and re-created.
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_APPEND |
static String |
DEFAULT_PATTERN |
static long |
DEFAULT_SIZE_LIMIT |
static TimeTable |
DEFAULT_TIME_TABLE |
static long |
NO_LIMIT
A special value for the
sizeLimit paramter of ArchivingFileHandler(String,
long, TimeTable, boolean, boolean, Level, Filter, Formatter, String) indicating that no limit should apply. |
DEFAULT_AUTO_FLUSH, DEFAULT_ENCODING, DEFAULT_FILTER, DEFAULT_FORMATTER, DEFAULT_LEVEL| Modifier and Type | Method and Description |
|---|---|
void |
publish(LogRecord record) |
close, flush, isLoggable, setEncoding, setOutputStreamgetEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevelpublic static final long NO_LIMIT
sizeLimit paramter of ArchivingFileHandler(String,
long, TimeTable, boolean, boolean, Level, Filter, Formatter, String) indicating that no limit should apply.public static final String DEFAULT_PATTERN
public static final long DEFAULT_SIZE_LIMIT
public static final TimeTable DEFAULT_TIME_TABLE
public static final boolean DEFAULT_APPEND
public ArchivingFileHandler()
throws ParseException,
EvaluationException,
IOException
LogManager).
The ArchivingFileHandler, like all java.util.logging handlers, initializes itself with a set of
"logging properties" which it retrieves through the LogManager, which normally reads them from the
"logging.properties" file:
.patternpattern parameter of ArchivingFileHandler(String, long, TimeTable, boolean, boolean, Level, Filter, Formatter, String).
Defaults to "%h/java%d.log".
.sizeLimit.timeTableTimeTable for log file archiving with this syntax.
Defaults to "never".
de.unkrig.commons.util.TimeTable.parse("*:0")" for "every full hour".
.appendfalse.
protected ArchivingFileHandler(int dummy,
@Nullable
String propertyNamePrefix)
throws ParseException,
EvaluationException,
IOException
ArchivingFileHandler().dummy - Only there to distinguish this constructor from ArchivingFileHandler(String)propertyNamePrefix - The property name prefix, or null to use the qualified name of the
actual handler classParseExceptionEvaluationExceptionIOExceptionpublic ArchivingFileHandler(String pattern) throws IOException
ArchivingFileHandler(pattern,
DEFAULT_SIZE_LIMIT,
DEFAULT_TIME_TABLE,
false,
true,
AbstractStreamHandler.DEFAULT_LEVEL,
AbstractStreamHandler.DEFAULT_FILTER,
AbstractStreamHandler.DEFAULT_FORMATTER,
AbstractStreamHandler.DEFAULT_ENCODING).IOExceptionpublic ArchivingFileHandler(String pattern, boolean append) throws IOException
ArchivingFileHandler(pattern,
9223372036854775807L,
DEFAULT_TIME_TABLE,
append,
true,
AbstractStreamHandler.DEFAULT_LEVEL,
AbstractStreamHandler.DEFAULT_FILTER,
AbstractStreamHandler.DEFAULT_FORMATTER,
AbstractStreamHandler.DEFAULT_ENCODING).IOExceptionpublic ArchivingFileHandler(String pattern, long sizeLimit) throws IOException
ArchivingFileHandler(pattern,
sizeLimit,
DEFAULT_TIME_TABLE,
false,
true,
AbstractStreamHandler.DEFAULT_LEVEL,
AbstractStreamHandler.DEFAULT_FILTER,
AbstractStreamHandler.DEFAULT_FORMATTER,
AbstractStreamHandler.DEFAULT_ENCODING).IOExceptionpublic ArchivingFileHandler(String pattern, long sizeLimit, boolean append) throws IOException
ArchivingFileHandler(pattern,
sizeLimit,
DEFAULT_TIME_TABLE,
append,
true,
AbstractStreamHandler.DEFAULT_LEVEL,
AbstractStreamHandler.DEFAULT_FILTER,
AbstractStreamHandler.DEFAULT_FORMATTER,
AbstractStreamHandler.DEFAULT_ENCODING).IOExceptionpublic ArchivingFileHandler(String pattern, TimeTable timeTable) throws IOException
ArchivingFileHandler(pattern,
9223372036854775807L,
timeTable,
false,
true,
AbstractStreamHandler.DEFAULT_LEVEL,
AbstractStreamHandler.DEFAULT_FILTER,
AbstractStreamHandler.DEFAULT_FORMATTER,
AbstractStreamHandler.DEFAULT_ENCODING).IOExceptionpublic ArchivingFileHandler(String pattern, TimeTable timeTable, boolean append) throws IOException
ArchivingFileHandler(pattern,
9223372036854775807L,
timeTable,
append,
true,
AbstractStreamHandler.DEFAULT_LEVEL,
AbstractStreamHandler.DEFAULT_FILTER,
AbstractStreamHandler.DEFAULT_FORMATTER,
AbstractStreamHandler.DEFAULT_ENCODING).IOExceptionpublic ArchivingFileHandler(String pattern, long sizeLimit, TimeTable timeTable, boolean append, boolean autoFlush, Level level, Filter filter, Formatter formatter, String encoding) throws IOException
%%"%"%huser.home" system property)%tjava.io.tmpdir" system property)%dDateFormat _yyyy-MM-dd_HH-mm-ss. For the
"current log file", "%d" is replaced with the empty string.
%d" placeholder, then "%d" is silently appended to the
pattern.
pattern - See the method descriptionsizeLimit - The size limit for the current filetimeTable - The time table for time-based archivingappend - Whether to append to the current log file (if it initially exists)autoFlush - See StreamHandler.StreamHandler(OutputStream, boolean, Level, Filter, Formatter, String)level - See StreamHandler.StreamHandler(OutputStream, boolean, Level, Filter, Formatter, String)filter - See StreamHandler.StreamHandler(OutputStream, boolean, Level, Filter, Formatter, String)formatter - See StreamHandler.StreamHandler(OutputStream, boolean, Level, Filter, Formatter, String)encoding - See StreamHandler.StreamHandler(OutputStream, boolean, Level, Filter, Formatter, String)IOExceptionpublic void publish(LogRecord record)
publish in class AbstractStreamHandlerCopyright © 2017 Arno Unkrig. All rights reserved.