Class LogAggregator
- java.lang.Object
-
- org.opends.server.loggers.LogAggregator
-
public final class LogAggregator extends Object
A simple log aggregator to prevent a burst of regularly repeated messages from flooding the logs.The aggregation can be based on time or on count.
Messages known to be generated for an event occurring very frequently, for every protocol message or periodically, can be logged at first occurrence and then only at increasing intervals (if based on time), or only after a number of occurrences (if based on count).
-
-
Constructor Summary
Constructors Constructor Description LogAggregator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
countBasedLog(LocalizedLogger logger, LocalizableMessage message)
Start the aggregation for a message that will be logged based on count and only after 2 occurrences.void
log(Consumer<LocalizableMessage> logMethod, LocalizableMessage message)
Log a message and start the aggregation for it.void
purgeAndLogMessageBursts()
Purge expired messages and log message bursts if any.
-
-
-
Method Detail
-
log
public void log(Consumer<LocalizableMessage> logMethod, LocalizableMessage message)
Log a message and start the aggregation for it.The message will be logged right away and if repeated, at fixed intervals. In case of burst (more than 20 times in a second), there will be a warning about it.
- Parameters:
logMethod
- how to log the messagemessage
- the message
-
countBasedLog
public void countBasedLog(LocalizedLogger logger, LocalizableMessage message)
Start the aggregation for a message that will be logged based on count and only after 2 occurrences.The message will be logged once as WARNING after 2 occurrences and once as ERROR after 5 occurrences. After that it will be logged at fixed intervals. In case of burst (more than 20 times in a second), there will be a warning about it.
This behavior is suited for connections errors.
- Parameters:
logger
- logger to use for the messagemessage
- the message
-
purgeAndLogMessageBursts
public void purgeAndLogMessageBursts()
Purge expired messages and log message bursts if any.
-
-