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 Details

    • threshold

      @NotNull protected @NotNull ch.qos.logback.classic.Level threshold
    • logFormat

      protected @Nullable String logFormat
    • layout

      @Valid protected @Nullable @Valid DiscoverableLayoutFactory<E extends ch.qos.logback.core.spi.DeferredProcessingAware> layout
    • timeZone

      @NotNull protected @NotNull TimeZone 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. A null value 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. A null value disables the rate limit.
      Since:
      2.0
    • getThreshold

      public String getThreshold()
    • setThreshold

      public void setThreshold(String threshold)
    • getLogFormat

      public @Nullable 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

      public @Nullable 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)