Package org.apache.solr.logging
Class LogWatcher<E>
- java.lang.Object
-
- org.apache.solr.logging.LogWatcher<E>
-
- Direct Known Subclasses:
JulWatcher
,Log4j2Watcher
public abstract class LogWatcher<E> extends Object
A Class to monitor Logging events and hold N events in memoryThis is abstract so we can support both JUL and Log4j2 (and other logging platforms)
-
-
Field Summary
Fields Modifier and Type Field Description protected CircularList<org.apache.solr.common.SolrDocument>
history
protected long
last
-
Constructor Summary
Constructors Constructor Description LogWatcher()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
add(E event, long timstamp)
abstract List<String>
getAllLevels()
abstract Collection<LoggerInfo>
getAllLoggers()
org.apache.solr.common.SolrDocumentList
getHistory(long since, AtomicBoolean found)
int
getHistorySize()
long
getLastEvent()
abstract String
getName()
abstract String
getThreshold()
static LogWatcher<?>
newRegisteredLogWatcher(LogWatcherConfig config, SolrResourceLoader loader)
Create and register a LogWatcher.abstract void
registerListener(ListenerConfig cfg)
void
reset()
abstract void
setLogLevel(String category, String level)
Sets the log level within this frameworkabstract void
setThreshold(String level)
abstract org.apache.solr.common.SolrDocument
toSolrDocument(E event)
-
-
-
Field Detail
-
history
protected CircularList<org.apache.solr.common.SolrDocument> history
-
last
protected long last
-
-
Method Detail
-
getName
public abstract String getName()
- Returns:
- The implementation name
-
getAllLevels
public abstract List<String> getAllLevels()
- Returns:
- The valid level names for this framework
-
setLogLevel
public abstract void setLogLevel(String category, String level)
Sets the log level within this framework
-
getAllLoggers
public abstract Collection<LoggerInfo> getAllLoggers()
- Returns:
- all registered loggers
-
setThreshold
public abstract void setThreshold(String level)
-
getThreshold
public abstract String getThreshold()
-
add
public void add(E event, long timstamp)
-
getLastEvent
public long getLastEvent()
-
getHistorySize
public int getHistorySize()
-
getHistory
public org.apache.solr.common.SolrDocumentList getHistory(long since, AtomicBoolean found)
-
toSolrDocument
public abstract org.apache.solr.common.SolrDocument toSolrDocument(E event)
-
registerListener
public abstract void registerListener(ListenerConfig cfg)
-
reset
public void reset()
-
newRegisteredLogWatcher
public static LogWatcher<?> newRegisteredLogWatcher(LogWatcherConfig config, SolrResourceLoader loader)
Create and register a LogWatcher.JUL and Log4j watchers are supported out-of-the-box. You can register your own LogWatcher implementation via the plugins architecture
- Parameters:
config
- a LogWatcherConfig object, containing the configuration for this LogWatcher.loader
- a SolrResourceLoader, to be used to load plugin LogWatcher implementations. Can be null if- Returns:
- a LogWatcher configured for the container's logging framework
-
-