Ejemplo n.º 1
0
 static Category getInstance(
     final LoggerContext context, final String name, final LoggerFactory factory) {
   final ConcurrentMap<String, Logger> loggers = getLoggersMap(context);
   Logger logger = loggers.get(name);
   if (logger != null) {
     return logger;
   }
   logger = factory.makeNewLoggerInstance(context, name);
   final Logger prev = loggers.putIfAbsent(name, logger);
   return prev == null ? logger : prev;
 }
 /**
  * Returns a logger instance created by loggerFactory. This method was requested in <a
  * href="http://jira.qos.ch/browse/SLF4J-225">SLF4J-225</a>. Note that log4j-over-slf4j does not
  * ship with a LoggerFactory implementation. If this method is called, the caller must provide
  * his/her own implementation.
  *
  * @param name the name of the desired logger
  * @param loggerFactory an instance of {@link LoggerFactory}
  * @return returns a logger instance created by loggerFactory
  * @since 1.6.6
  */
 public static Logger getLogger(String name, LoggerFactory loggerFactory) {
   return loggerFactory.makeNewLoggerInstance(name);
 }