Package io.dropwizard.logging
Class AbstractAppenderFactory<E extends ch.qos.logback.core.spi.DeferredProcessingAware>
- java.lang.Object
-
- io.dropwizard.logging.AbstractAppenderFactory<E>
-
- All Implemented Interfaces:
Discoverable,AppenderFactory<E>
- Direct Known Subclasses:
AbstractOutputStreamAppenderFactory,SyslogAppenderFactory
public abstract class AbstractAppenderFactory<E extends ch.qos.logback.core.spi.DeferredProcessingAware> extends Object implements AppenderFactory<E>
A base implementation ofAppenderFactory. Configuration Parameters:Name Default Description thresholdALL The minimum event level the appender will handle. logFormat(none) An appender-specific log format. timeZoneUTCThe time zone to which event timestamps will be converted. Ignored if logFormat is supplied. queueSizeAsyncAppenderBaseThe maximum capacity of the blocking queue. includeCallerDataAsyncAppenderBaseWhether to include caller data, required for line numbers. Beware, is considered expensive. discardingThresholdAsyncAppenderBaseBy default, when the blocking queue has 20% capacity remaining, it will drop events of level TRACE, DEBUG and INFO, keeping only events of level WARN and ERROR. To keep all events, set discardingThreshold to 0. messageRateMaximum message rate: average duration between messages. Extra messages are discarded. This setting avoids flooding a paid logging service by accident. For example, a duration of 100ms allows for a maximum of 10 messages per second and 30s would mean 1 message every 30 seconds. The maximum acceptable duration is 1 minute. By default, this duration is not set and this feature is disabled. filterFactories(none) A list of filtersto apply to the appender, in order, after thethreshold.
-
-
Constructor Summary
Constructors Constructor Description AbstractAppenderFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ch.qos.logback.core.LayoutBase<E>buildLayout(ch.qos.logback.classic.LoggerContext context, LayoutFactory<E> defaultLayoutFactory)intgetDiscardingThreshold()List<FilterFactory<E>>getFilterFactories()DiscoverableLayoutFactory<?>getLayout()StringgetLogFormat()DurationgetMessageRate()intgetQueueSize()StringgetThreshold()TimeZonegetTimeZone()booleanisIncludeCallerData()voidsetDiscardingThreshold(int discardingThreshold)voidsetFilterFactories(List<FilterFactory<E>> appenders)voidsetIncludeCallerData(boolean includeCallerData)voidsetLayout(DiscoverableLayoutFactory<E> layout)voidsetLogFormat(String logFormat)voidsetMessageRate(Duration messageRate)voidsetNeverBlock(boolean neverBlock)voidsetQueueSize(int queueSize)voidsetThreshold(String threshold)voidsetTimeZone(String zoneId)voidsetTimeZone(TimeZone timeZone)protected ch.qos.logback.core.Appender<E>wrapAsync(ch.qos.logback.core.Appender<E> appender, AsyncAppenderFactory<E> asyncAppenderFactory)protected ch.qos.logback.core.Appender<E>wrapAsync(ch.qos.logback.core.Appender<E> appender, AsyncAppenderFactory<E> asyncAppenderFactory, ch.qos.logback.core.Context context)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.dropwizard.logging.AppenderFactory
build
-
-
-
-
Field Detail
-
threshold
@NotNull protected @NotNull ch.qos.logback.classic.Level threshold
-
logFormat
@Nullable protected String logFormat
-
layout
@Nullable protected DiscoverableLayoutFactory<E extends ch.qos.logback.core.spi.DeferredProcessingAware> layout
-
timeZone
@NotNull protected @NotNull TimeZone timeZone
-
-
Method Detail
-
getQueueSize
public int getQueueSize()
-
setQueueSize
public void setQueueSize(int queueSize)
-
getDiscardingThreshold
public int getDiscardingThreshold()
-
setDiscardingThreshold
public void setDiscardingThreshold(int discardingThreshold)
-
getMessageRate
@Nullable public Duration getMessageRate()
- Since:
- 2.0
-
setMessageRate
public void setMessageRate(Duration messageRate)
- Since:
- 2.0
-
getThreshold
public String getThreshold()
-
setThreshold
public void setThreshold(String threshold)
-
getLogFormat
@Nullable public String getLogFormat()
-
setLogFormat
public void setLogFormat(@Nullable String logFormat)
-
getTimeZone
public TimeZone getTimeZone()
-
setTimeZone
public void setTimeZone(String zoneId)
-
setTimeZone
public void setTimeZone(TimeZone timeZone)
-
isIncludeCallerData
public boolean isIncludeCallerData()
-
setIncludeCallerData
public void setIncludeCallerData(boolean includeCallerData)
-
getFilterFactories
public List<FilterFactory<E>> getFilterFactories()
-
setFilterFactories
public void setFilterFactories(List<FilterFactory<E>> appenders)
-
setNeverBlock
public void setNeverBlock(boolean neverBlock)
-
getLayout
@Nullable public DiscoverableLayoutFactory<?> getLayout()
-
setLayout
public void setLayout(@Nullable DiscoverableLayoutFactory<E> layout)
-
wrapAsync
protected ch.qos.logback.core.Appender<E> wrapAsync(ch.qos.logback.core.Appender<E> appender, AsyncAppenderFactory<E> asyncAppenderFactory)
-
wrapAsync
protected ch.qos.logback.core.Appender<E> wrapAsync(ch.qos.logback.core.Appender<E> appender, AsyncAppenderFactory<E> asyncAppenderFactory, ch.qos.logback.core.Context context)
-
buildLayout
protected ch.qos.logback.core.LayoutBase<E> buildLayout(ch.qos.logback.classic.LoggerContext context, LayoutFactory<E> defaultLayoutFactory)
-
-