Package io.dropwizard.logging.common
Class AbstractAppenderFactory<E extends ch.qos.logback.core.spi.DeferredProcessingAware>
java.lang.Object
io.dropwizard.logging.common.AbstractAppenderFactory<E>
- All Implemented Interfaces:
io.dropwizard.jackson.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 of
AppenderFactory.
Configuration Parameters:
| Name | Default | Description |
threshold |
ALL | The minimum event level the appender will handle. |
logFormat |
(none) | An appender-specific log format. |
timeZone |
UTC |
The time zone to which event timestamps will be converted. Ignored if logFormat is supplied. |
queueSize |
AsyncAppenderBase |
The maximum capacity of the blocking queue. |
includeCallerData |
AsyncAppenderBase |
Whether to include caller data, required for line numbers. Beware, is considered expensive. |
discardingThreshold |
AsyncAppenderBase |
By 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. |
messageRate |
Maximum 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 filters to apply to the appender, in order,
after the threshold.
|
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ch.qos.logback.core.LayoutBase<E>buildLayout(ch.qos.logback.classic.LoggerContext context, LayoutFactory<E> defaultLayoutFactory) int@Nullable DiscoverableLayoutFactory<?>@Nullable String@Nullable io.dropwizard.util.DurationReturns the duration required between logged messages.intbooleanvoidsetDiscardingThreshold(int discardingThreshold) voidsetFilterFactories(List<FilterFactory<E>> appenders) voidsetIncludeCallerData(boolean includeCallerData) voidsetLayout(@Nullable DiscoverableLayoutFactory<E> layout) voidsetLogFormat(@Nullable String logFormat) voidsetMessageRate(io.dropwizard.util.Duration messageRate) Sets the time period required between logged messages.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, waitMethods inherited from interface io.dropwizard.logging.common.AppenderFactory
build
-
Field Details
-
threshold
@NotNull protected @NotNull ch.qos.logback.classic.Level threshold -
logFormat
-
layout
@Valid protected @Nullable @Valid DiscoverableLayoutFactory<E extends ch.qos.logback.core.spi.DeferredProcessingAware> layout -
timeZone
-
-
Constructor Details
-
AbstractAppenderFactory
public AbstractAppenderFactory()
-
-
Method Details
-
getQueueSize
public int getQueueSize() -
setQueueSize
public void setQueueSize(int queueSize) -
getDiscardingThreshold
public int getDiscardingThreshold() -
setDiscardingThreshold
public void setDiscardingThreshold(int discardingThreshold) -
getMessageRate
public @Nullable io.dropwizard.util.Duration getMessageRate()Returns the duration required between logged messages. Messages logged more frequently than this will be dropped. Anullvalue means there is no rate limit.- Since:
- 2.0
-
setMessageRate
public void setMessageRate(io.dropwizard.util.Duration messageRate) Sets the time period required between logged messages. Messages logged more frequently than this will be dropped. Anullvalue disables the rate limit.- Since:
- 2.0
-
getThreshold
-
setThreshold
-
getLogFormat
-
setLogFormat
-
getTimeZone
-
setTimeZone
-
setTimeZone
-
isIncludeCallerData
public boolean isIncludeCallerData() -
setIncludeCallerData
public void setIncludeCallerData(boolean includeCallerData) -
getFilterFactories
-
setFilterFactories
-
setNeverBlock
public void setNeverBlock(boolean neverBlock) -
getLayout
-
setLayout
-
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)
-