1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.logging

File LoggerManager.java

 

Code metrics

0
0
0
1
81
14
0
-
-
0
-

Classes

Class Line # Actions
LoggerManager 35 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.logging;
21   
22    import java.util.Collection;
23   
24    import org.slf4j.Logger;
25    import org.xwiki.component.annotation.Role;
26    import org.xwiki.observation.EventListener;
27   
28    /**
29    * Provide some logging management APIs such as the ability to redirect logs to an {@link EventListener}.
30    *
31    * @version $Id: 3dc731b3efedcf034f2699bad7250817fd6ca4d7 $
32    * @since 3.2M3
33    */
34    @Role
 
35    public interface LoggerManager
36    {
37    /**
38    * Grab subsequent logs produced by the current thread and send them to the provided listener.
39    * <p>
40    * Note that the logs generated by the current thread will not be output anymore by the logging system implementing
41    * the SLF4J API (Technically, this is done, for example when the implementation is LogBack, by dynamically
42    * replacing the LogBack appender with our own).
43    * </p>
44    * <p>
45    * After this method is called, logs will be only be received as XWiki events sent to the provided listener. In
46    * addition, it also overrides any previous call to {@link #pushLogListener(EventListener)} (which will get active
47    * again after a call to {@link #popLogListener()}).
48    * </p>
49    *
50    * @param listener the listener that will receive all future logging events
51    */
52    void pushLogListener(EventListener listener);
53   
54    /**
55    * Remove the current listener from the current thread stack.
56    * <p>
57    * If several listeners have been pushed it makes the previous one active again.
58    *
59    * @return the previous log events listener for the current thread
60    */
61    EventListener popLogListener();
62   
63    /**
64    * Associate the passed logger to the passed log level.
65    *
66    * @param loggerName the logger
67    * @param level the level of the logger
68    */
69    void setLoggerLevel(String loggerName, LogLevel level);
70   
71    /**
72    * @param loggerName the logger
73    * @return the log level associated to the logger, return null if the level is inherited from parent logger
74    */
75    LogLevel getLoggerLevel(String loggerName);
76   
77    /**
78    * @return all the registered loggers
79    */
80    Collection<Logger> getLoggers();
81    }