public class LogSilencer
extends java.lang.Object
The key, together with the timeout, will be put into a small LRU cache and later used to determine silencing or not.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SILENCING_POSTFIX |
Constructor and Description |
---|
LogSilencer() |
LogSilencer(long silenceMillis,
int cacheSize)
Create a new LogSilencer
|
Modifier and Type | Method and Description |
---|---|
boolean |
silence(java.lang.String key)
Determine whether based on a provided key logging about that key should be silenced.
|
public static final java.lang.String SILENCING_POSTFIX
public LogSilencer()
public LogSilencer(long silenceMillis, int cacheSize)
silenceMillis
- milliseconds after which the silences herein should time out.
If the value is <0 it means no timeout, if it is ==0 it is silenced only
for the very same millisecond, and >0 the silence is active for that specified
amount of time.cacheSize
- the size of the cache held by the LogSilencer. The cache is
used to store the keys and timeout values for each of them.public final boolean silence(java.lang.String key)
The actual scope and context of the provided key is entirely up to the caller and not relevant for the LogSilencer. All the LogSilencer is trying to do is to provide a mechanism to "silence based on a key"
key
- a key within the caller's context which identified some logCopyright © 2012–2022 The Apache Software Foundation. All rights reserved.