@Role
public interface LoggerManager
EventListener
.Modifier and Type | Method and Description |
---|---|
default LoggerTail |
createLoggerTail(Path file,
boolean readonly)
Create a
LoggerTail in charge of navigating and appending the passed file with logs. |
LogLevel |
getLoggerLevel(String loggerName) |
Collection<org.slf4j.Logger> |
getLoggers() |
EventListener |
popLogListener()
Remove the current listener from the current thread stack.
|
void |
pushLogListener(EventListener listener)
Grab subsequent logs produced by the current thread and send them to the provided listener.
|
void |
setLoggerLevel(String loggerName,
LogLevel level)
Associate the passed logger to the passed log level.
|
void pushLogListener(EventListener listener)
Note that the logs generated by the current thread will not be output anymore by the logging system implementing the SLF4J API (Technically, this is done, for example when the implementation is LogBack, by dynamically replacing the LogBack appender with our own).
After this method is called, logs will be only be received as XWiki events sent to the provided listener. In
addition, it also overrides any previous call to pushLogListener(EventListener)
(which will get active
again after a call to popLogListener()
).
listener
- the listener that will receive all future logging eventsEventListener popLogListener()
If several listeners have been pushed it makes the previous one active again.
void setLoggerLevel(String loggerName, LogLevel level)
loggerName
- the loggerlevel
- the level of the loggerLogLevel getLoggerLevel(String loggerName)
loggerName
- the loggerCollection<org.slf4j.Logger> getLoggers()
default LoggerTail createLoggerTail(Path file, boolean readonly) throws IOException
LoggerTail
in charge of navigating and appending the passed file with logs.file
- the file where to store the logreadonly
- true of the log is read onlyLoggerTail
instanceIOException
- when failing to open the LoggerTail
Copyright © 2004–2022 XWiki. All rights reserved.