public class FileAppenderFactory extends AbstractAppenderFactory
AppenderFactory implementation which provides an appender that writes events to a file, archiving older
files as it goes.
Configuration Parameters:
| Name | Default | Description |
type |
REQUIRED | The appender type. Must be file. |
threshold |
ALL |
The lowest level of events to write to the file. |
currentLogFilename |
REQUIRED | The filename where current events are logged. |
archive |
true |
Whether or not to archive old events in separate files. |
archivedLogFilenamePattern |
REQUIRED if archive is true. |
The filename pattern for archived files. %d is replaced with the date in yyyy-MM-dd form,
and the fact that it ends with .gz indicates the file will be gzipped as it's archived. Likewise,
filename patterns which end in .zip will be filled as they are archived.
|
archivedFileCount |
5 |
The number of archived files to keep. Must be greater than 0.
|
timeZone |
UTC |
The time zone to which event timestamps will be converted. |
logFormat |
the default format | The Logback pattern with which events will be formatted. See the Logback documentation for details. |
AbstractAppenderFactorylogFormat, threshold| Constructor and Description |
|---|
FileAppenderFactory() |
| Modifier and Type | Method and Description |
|---|---|
ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> |
build(ch.qos.logback.classic.LoggerContext context,
String applicationName,
ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent> layout)
Given a Logback context, an application name, and a layout, build a new appender.
|
protected ch.qos.logback.core.FileAppender<ch.qos.logback.classic.spi.ILoggingEvent> |
buildAppender(ch.qos.logback.classic.LoggerContext context) |
int |
getArchivedFileCount() |
String |
getArchivedLogFilenamePattern() |
String |
getCurrentLogFilename() |
TimeZone |
getTimeZone() |
boolean |
isArchive() |
boolean |
isValidArchiveConfiguration() |
void |
setArchive(boolean archive) |
void |
setArchivedFileCount(int archivedFileCount) |
void |
setArchivedLogFilenamePattern(String archivedLogFilenamePattern) |
void |
setCurrentLogFilename(String currentLogFilename) |
void |
setTimeZone(TimeZone timeZone) |
addThresholdFilter, buildLayout, getDiscardingThreshold, getLogFormat, getQueueSize, getThreshold, setDiscardingThreshold, setLogFormat, setQueueSize, setThreshold, wrapAsync, wrapAsyncpublic String getCurrentLogFilename()
public void setCurrentLogFilename(String currentLogFilename)
public boolean isArchive()
public void setArchive(boolean archive)
public String getArchivedLogFilenamePattern()
public void setArchivedLogFilenamePattern(String archivedLogFilenamePattern)
public int getArchivedFileCount()
public void setArchivedFileCount(int archivedFileCount)
public TimeZone getTimeZone()
public void setTimeZone(TimeZone timeZone)
@ValidationMethod(message="must have archivedLogFilenamePattern if archive is true") public boolean isValidArchiveConfiguration()
public ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent> build(ch.qos.logback.classic.LoggerContext context,
String applicationName,
ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent> layout)
AppenderFactorycontext - the Logback contextapplicationName - the application namelayout - the layout for loggingAppenderprotected ch.qos.logback.core.FileAppender<ch.qos.logback.classic.spi.ILoggingEvent> buildAppender(ch.qos.logback.classic.LoggerContext context)
Copyright © 2015. All rights reserved.