Class LogSilencer
java.lang.Object
org.apache.jackrabbit.oak.commons.log.LogSilencer
Utility class to silence log output based on a specific key.
The key, together with the timeout, will be put into a small LRU cache and later used to determine silencing or not.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
SILENCING_POSTFIX
- See Also:
-
-
Constructor Details
-
LogSilencer
public LogSilencer() -
LogSilencer
public LogSilencer(long silenceMillis, int cacheSize) Create a new LogSilencer- Parameters:
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.
-
-
Method Details
-
silence
Determine whether based on a provided key logging about that key should be silenced.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"
- Parameters:
key
- a key within the caller's context which identified some log- Returns:
- whether a silence for the provided key is in place or not. The silence times out after a certain, configurable amount of time.
-