This class is a minimal implementation of the original org.apache.log4j.LogManager class (as found in log4j 1.2) delegating all calls to SLF4J. This implementation does NOT implement the setRepositorySelector(), getLoggerRepository(), exists(), getCurrentLoggers(), shutdo
| 34 | * @author Ceki Gülcü |
| 35 | */ |
| 36 | @SuppressWarnings("rawtypes") |
| 37 | public class LogManager { |
| 38 | |
| 39 | public static Logger getRootLogger() { |
| 40 | return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); |
| 41 | } |
| 42 | |
| 43 | public static Logger getLogger(final String name) { |
| 44 | return Log4jLoggerFactory.getLogger(name); |
| 45 | } |
| 46 | |
| 47 | public static Logger getLogger(final Class clazz) { |
| 48 | return Log4jLoggerFactory.getLogger(clazz.getName()); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Returns a logger instance created by loggerFactory. This method was requested in |
| 53 | * <a href="http://jira.qos.ch/browse/SLF4J-225">SLF4J-225</a>. Note that |
| 54 | * log4j-over-slf4j does not ship with a LoggerFactory implementation. If this |
| 55 | * method is called, the caller must provide his/her own implementation. |
| 56 | * |
| 57 | * @param name the name of the desired logger |
| 58 | * @param loggerFactory an instance of {@link LoggerFactory} |
| 59 | * @return returns a logger instance created by loggerFactory |
| 60 | * @since 1.6.6 |
| 61 | */ |
| 62 | public static Logger getLogger(String name, LoggerFactory loggerFactory) { |
| 63 | return loggerFactory.makeNewLoggerInstance(name); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * This bogus implementation returns an empty enumeration. |
| 68 | * |
| 69 | * @return an Enumeration of current loggers |
| 70 | */ |
| 71 | public static Enumeration getCurrentLoggers() { |
| 72 | return new Vector().elements(); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Implemented as NOP. |
| 77 | */ |
| 78 | public static void shutdown() { |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Implemented as NOP. |
| 83 | */ |
| 84 | public static void resetConfiguration() { |
| 85 | } |
| 86 | } |
nothing calls this directly
no outgoing calls
no test coverage detected