org.xwiki.logging
Interface LoggerManager


@Role
public interface LoggerManager

Provide some logging management APIs such as the ability to redirect logs to an EventListener.

Since:
3.2M3
Version:
$Id: 76a7b08c84d4043d4db6875904fe5e5014e60e31 $

Method Summary
 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.
 

Method Detail

pushLogListener

void pushLogListener(EventListener listener)
Grab subsequent logs produced by the current thread and send them to the provided 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()).

Parameters:
listener - the listener that will receive all future logging events

popLogListener

EventListener popLogListener()
Remove the current listener from the current thread stack.

If several listeners have been pushed it makes the previous one active again.

Returns:
the previous log events listener for the current thread

setLoggerLevel

void setLoggerLevel(String loggerName,
                    LogLevel level)
Associate the passed logger to the passed log level.

Parameters:
loggerName - the logger
level - the level of the logger

getLoggerLevel

LogLevel getLoggerLevel(String loggerName)
Parameters:
loggerName - the logger
Returns:
the log level associated to the logger, return null if the level is inherited from parent logger

getLoggers

Collection<org.slf4j.Logger> getLoggers()
Returns:
all the registered loggers


Copyright © 2004-2013 XWiki. All Rights Reserved.