public class FileAppenderFactory<E extends ch.qos.logback.core.spi.DeferredProcessingAware> extends AbstractAppenderFactory<E>
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.
|
maxFileSize |
(unlimited) | The maximum size of the currently active file before a rollover is triggered. The value can be expressed in bytes, kilobytes, megabytes, gigabytes, and terabytes by appending B, K, MB, GB, or TB to the numeric value. Examples include 100MB, 1GB, 1TB. Sizes can also be spelled out, such as 100 megabytes, 1 gigabyte, 1 terabyte. |
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, timeZone| Constructor and Description |
|---|
FileAppenderFactory() |
| Modifier and Type | Method and Description |
|---|---|
ch.qos.logback.core.Appender<E> |
build(ch.qos.logback.classic.LoggerContext context,
String applicationName,
LayoutFactory<E> layoutFactory,
LevelFilterFactory<E> levelFilterFactory,
AsyncAppenderFactory<E> asyncAppenderFactory)
Given a Logback context, an application name, a layout,
a levelFilterFactory, and an asyncAppenderFactory build a new appender.
|
protected ch.qos.logback.core.FileAppender<E> |
buildAppender(ch.qos.logback.classic.LoggerContext context) |
int |
getArchivedFileCount() |
String |
getArchivedLogFilenamePattern() |
String |
getCurrentLogFilename() |
io.dropwizard.util.Size |
getMaxFileSize() |
boolean |
isArchive() |
boolean |
isMaxFileSizeSettingSpecified() |
boolean |
isValidArchiveConfiguration() |
boolean |
isValidForMaxFileSizeSetting() |
void |
setArchive(boolean archive) |
void |
setArchivedFileCount(int archivedFileCount) |
void |
setArchivedLogFilenamePattern(String archivedLogFilenamePattern) |
void |
setCurrentLogFilename(String currentLogFilename) |
void |
setMaxFileSize(io.dropwizard.util.Size maxFileSize) |
buildLayout, getDiscardingThreshold, getFilterFactories, getLogFormat, getQueueSize, getThreshold, getTimeZone, isIncludeCallerData, setDiscardingThreshold, setFilterFactories, setIncludeCallerData, setLogFormat, setQueueSize, setThreshold, setTimeZone, 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 io.dropwizard.util.Size getMaxFileSize()
public void setMaxFileSize(io.dropwizard.util.Size maxFileSize)
@ValidationMethod(message="must have archivedLogFilenamePattern if archive is true") public boolean isValidArchiveConfiguration()
@ValidationMethod(message="when specifying maxFileSize, archivedLogFilenamePattern must contain %i") public boolean isValidForMaxFileSizeSetting()
@ValidationMethod(message="when archivedLogFilenamePattern contains %i, maxFileSize must be specified") public boolean isMaxFileSizeSettingSpecified()
public ch.qos.logback.core.Appender<E> build(ch.qos.logback.classic.LoggerContext context, String applicationName, LayoutFactory<E> layoutFactory, LevelFilterFactory<E> levelFilterFactory, AsyncAppenderFactory<E> asyncAppenderFactory)
AppenderFactorycontext - the Logback contextapplicationName - the application namelayoutFactory - the factory for the layout for logginglevelFilterFactory - the factory for the level filterasyncAppenderFactory - the factory for the async appenderAppenderprotected ch.qos.logback.core.FileAppender<E> buildAppender(ch.qos.logback.classic.LoggerContext context)
Copyright © 2016. All rights reserved.