Package io.dropwizard.metrics5.log4j2
Class InstrumentedAppender
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.filter.AbstractFilterable
org.apache.logging.log4j.core.appender.AbstractAppender
io.dropwizard.metrics5.log4j2.InstrumentedAppender
- All Implemented Interfaces:
org.apache.logging.log4j.core.Appender,org.apache.logging.log4j.core.filter.Filterable,org.apache.logging.log4j.core.impl.LocationAware,org.apache.logging.log4j.core.LifeCycle,org.apache.logging.log4j.core.LifeCycle2
@Plugin(name="MetricsAppender",
category="Core",
elementType="appender")
public class InstrumentedAppender
extends org.apache.logging.log4j.core.appender.AbstractAppender
A Log4J 2.x
Appender which has seven meters, one for each logging level and one for the total
number of statements being logged. The meter names are the logging level names appended to the
name of the appender.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
org.apache.logging.log4j.core.appender.AbstractAppender.Builder<B extends org.apache.logging.log4j.core.appender.AbstractAppender.Builder<B>>Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
org.apache.logging.log4j.core.LifeCycle.State -
Field Summary
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGERFields inherited from interface org.apache.logging.log4j.core.Appender
ELEMENT_TYPE -
Constructor Summary
Constructors Constructor Description InstrumentedAppender(io.dropwizard.metrics5.MetricRegistry registry)Create a new instrumented appender using the given registry.InstrumentedAppender(io.dropwizard.metrics5.MetricRegistry registry, org.apache.logging.log4j.core.Filter filter, org.apache.logging.log4j.core.Layout<? extends Serializable> layout, boolean ignoreExceptions)Create a new instrumented appender using the given registry.InstrumentedAppender(String registryName)Create a new instrumented appender using the given registry name.InstrumentedAppender(String appenderName, io.dropwizard.metrics5.MetricRegistry registry)Create a new instrumented appender using the given appender name and registry.InstrumentedAppender(String registryName, org.apache.logging.log4j.core.Filter filter, org.apache.logging.log4j.core.Layout<? extends Serializable> layout, boolean ignoreExceptions)Create a new instrumented appender using the given registry name. -
Method Summary
Modifier and Type Method Description voidappend(org.apache.logging.log4j.core.LogEvent event)static InstrumentedAppendercreateAppender(String name, String registry)voidstart()Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toStringMethods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter, stop, stopMethods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.logging.log4j.core.LifeCycle
getState, initialize, isStarted, isStopped, stop
-
Constructor Details
-
InstrumentedAppender
public InstrumentedAppender(String registryName, org.apache.logging.log4j.core.Filter filter, org.apache.logging.log4j.core.Layout<? extends Serializable> layout, boolean ignoreExceptions)Create a new instrumented appender using the given registry name.- Parameters:
registryName- the name of the registry inSharedMetricRegistriesfilter- The Filter to associate with the Appender.layout- The layout to use to format the event.ignoreExceptions- If true, exceptions will be logged and suppressed. If false errors will be logged and then passed to the application.
-
InstrumentedAppender
Create a new instrumented appender using the given registry name.- Parameters:
registryName- the name of the registry inSharedMetricRegistries
-
InstrumentedAppender
public InstrumentedAppender(io.dropwizard.metrics5.MetricRegistry registry)Create a new instrumented appender using the given registry.- Parameters:
registry- the metric registry
-
InstrumentedAppender
public InstrumentedAppender(io.dropwizard.metrics5.MetricRegistry registry, org.apache.logging.log4j.core.Filter filter, org.apache.logging.log4j.core.Layout<? extends Serializable> layout, boolean ignoreExceptions)Create a new instrumented appender using the given registry.- Parameters:
registry- the metric registryfilter- The Filter to associate with the Appender.layout- The layout to use to format the event.ignoreExceptions- If true, exceptions will be logged and suppressed. If false errors will be logged and then passed to the application.
-
InstrumentedAppender
Create a new instrumented appender using the given appender name and registry.- Parameters:
appenderName- The name of the appender.registry- the metric registry
-
-
Method Details
-
createAppender
@PluginFactory public static InstrumentedAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute(value="registryName",defaultString="log4j2Metrics") String registry) -
start
public void start()- Specified by:
startin interfaceorg.apache.logging.log4j.core.LifeCycle- Overrides:
startin classorg.apache.logging.log4j.core.filter.AbstractFilterable
-
append
public void append(org.apache.logging.log4j.core.LogEvent event)
-