@InterfaceAudience.Private
@InterfaceStability.Unstable
public class Log4jWarningErrorMetricsAppender
extends org.apache.log4j.AppenderSkeleton
Modifier and Type | Class and Description |
---|---|
static class |
Log4jWarningErrorMetricsAppender.Element |
Modifier and Type | Field and Description |
---|---|
static String |
LOG_METRICS_APPENDER |
Constructor and Description |
---|
Log4jWarningErrorMetricsAppender()
Create an appender to keep track of the errors and warnings logged by the
system.
|
Log4jWarningErrorMetricsAppender(int cleanupIntervalSeconds,
long messageAgeLimitSeconds,
int maxUniqueMessages)
Create an appender to keep track of the errors and warnings logged by the
system.
|
Modifier and Type | Method and Description |
---|---|
protected void |
append(org.apache.log4j.spi.LoggingEvent event) |
void |
close() |
static Log4jWarningErrorMetricsAppender |
findAppender() |
long |
getCleanupInterval() |
List<Integer> |
getErrorCounts(List<Long> cutoffs)
Get the counts of errors in the time periods provided.
|
List<Map<String,Log4jWarningErrorMetricsAppender.Element>> |
getErrorMessagesAndCounts(List<Long> cutoffs)
Get the errors and the number of occurrences for each of the errors for the
time cutoffs provided.
|
int |
getMaxUniqueMessages() |
long |
getMessageAgeLimitSeconds() |
List<Integer> |
getWarningCounts(List<Long> cutoffs)
Get the counts of warnings in the time periods provided.
|
List<Map<String,Log4jWarningErrorMetricsAppender.Element>> |
getWarningMessagesAndCounts(List<Long> cutoffs)
Get the warning and the number of occurrences for each of the warnings for
the time cutoffs provided.
|
boolean |
requiresLayout() |
void |
setCleanupInterval(long cleanupInterval) |
void |
setMaxUniqueMessages(int maxUniqueMessages) |
void |
setMessageAgeLimitSeconds(long messageAgeLimitSeconds) |
public static final String LOG_METRICS_APPENDER
public Log4jWarningErrorMetricsAppender()
public Log4jWarningErrorMetricsAppender(int cleanupIntervalSeconds, long messageAgeLimitSeconds, int maxUniqueMessages)
cleanupIntervalSeconds
- the interval at which old messages are purged to prevent the
message stores from growing unboundedmessageAgeLimitSeconds
- the maximum age of a message in seconds before it is purged from
the storemaxUniqueMessages
- the maximum number of unique messages of each type we keep before
we start purgingprotected void append(org.apache.log4j.spi.LoggingEvent event)
append
in class org.apache.log4j.AppenderSkeleton
public void close()
public boolean requiresLayout()
public List<Integer> getErrorCounts(List<Long> cutoffs)
cutoffs
- list of timestamp cutoffs(in seconds) for which the counts are
desiredpublic List<Integer> getWarningCounts(List<Long> cutoffs)
cutoffs
- list of timestamp cutoffs(in seconds) for which the counts are
desiredpublic List<Map<String,Log4jWarningErrorMetricsAppender.Element>> getErrorMessagesAndCounts(List<Long> cutoffs)
cutoffs
- list of timestamp cutoffs(in seconds) for which the counts are
desiredpublic List<Map<String,Log4jWarningErrorMetricsAppender.Element>> getWarningMessagesAndCounts(List<Long> cutoffs)
cutoffs
- list of timestamp cutoffs(in seconds) for which the counts are
desiredpublic long getCleanupInterval()
public void setCleanupInterval(long cleanupInterval)
public long getMessageAgeLimitSeconds()
public void setMessageAgeLimitSeconds(long messageAgeLimitSeconds)
public int getMaxUniqueMessages()
public void setMaxUniqueMessages(int maxUniqueMessages)
public static Log4jWarningErrorMetricsAppender findAppender()
Copyright © 2008–2024 Apache Software Foundation. All rights reserved.