Return a logger with the specified name, creating it if necessary.
160665
def get_logger(logger_name):
    

    # Use default global logger
    if logger_name is None:
        return __instance

    assert isinstance(logger_name, str), 'Logger name must be a string!'

    with __lock:
        if logger_name in __loggers:
            return __loggers[logger_name]

        logger_instance = LogOne(logger_name=logger_name)
        __loggers[logger_name] = logger_instance
        return logger_instance
653318
public static Logger getConsoleLogger(final String name) {
        return new Logger() {
            @Override
            public void log(String description, Object... params) {
                System.out.print("[" + name + "]: " + description + "\t");
                for (Object param: params)
                    System.out.print(param + "\t");
                System.out.println();
            }
        };
    }
583581
def get_logger(name):
    """"""
    if name in loggers:
        return loggers[name]
    logger = logging.getLogger(name)
    logger.propagate = False
    pre1, suf1 = hash_coloured_escapes(name) if supports_color() else ('', '')
    pre2, suf2 = hash_coloured_escapes(name + 'salt')  \
                 if supports_color() else ('', '')
    formatter = logging.Formatter(
        '%(levelname)s {}+{}+{} '
        '%(name)s: %(message)s'.format(pre1, pre2, suf1)
    )
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    logger.addHandler(ch)
    loggers[name] = logger

    logger.once_dict = {}

    return logger
1232507
def logger(self):
        
        if self._logger is None:
            self._logger = self.new_logger()
        return self._logger
450070
public static Logger getLogger(Class<?> cls,
                                   String resourcename,
                                   String loggerName) {
        return createLogger(cls, resourcename, loggerName);
    }
493823
def logger(self):
        """"""
        try:
            return self._logger
        except AttributeError:
            name = '%s.%s' % (self.__module__, self.__class__.__name__)
            self._logger = logging.getLogger(name)
            self.logger.debug('Initializing...')
            return self._logger
1203022
public Logger getLogger (String name)
    {
        return new Impl(org.apache.log4j.Logger.getLogger(name));
    }
1321440
public Logger getLogger(String name) {
        // the root logger is called "" in JUL
        if (name.equalsIgnoreCase(Logger.ROOT_LOGGER_NAME)) {
            name = "";
        }

        Logger slf4jLogger = loggerMap.get(name);
        if (slf4jLogger != null)
            return slf4jLogger;
        else {
            java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(name);
            Logger newInstance = new JDK14LoggerAdapter(julLogger);
            Logger oldInstance = loggerMap.putIfAbsent(name, newInstance);
            return oldInstance == null ? newInstance : oldInstance;
        }
    }
378607
@Override
    public Logger getLogger(String name) {
        // get the logger from the super impl
        Logger logger = super.getLogger(name);
        // At this point we don't know which concrete class to use until the
        // ras/logging provider is initialized enough to provide a
        // wsLogger class
        if (wsLogger == null) {
            return logger;
        }

        // The Java Logging (JSR47) spec requires that the method,
        // LogManager.getLogManager().getLogger(...) returns null if the logger
        // with the passed in name does not exist. However, the method
        // Logger.getLogger(...)
        // calls this method in order to create a new Logger object. In WAS, we
        // always want the call to Logger.getLogger(...) to return an instance
        // of WsLogger. If this method returns null to it (as the spec requires),
        // then Logger.getLogger() would return an instance of java.util.logging.Logger
        // rather than our WsLogger.
        // To account for this "issue", we need to return null when a customer
        // calls this method and passes in a non-existent logger name, but must
        // create a new WsLogger when Logger.getLogger() calls this method. As
        // such, the following code will get the current thread's stack trace
        // and look for a pattern like:
        // ...
        // at com.ibm.ws.bootstrap.WsLogManager.getLogger ...
        // at java.util.logging.Logger.getLogger ...
        // ...
        // If it identifies this pattern in the stacktrace, this method will
        // create a new logger. If not, it will return null.
        if (logger == null) {
            boolean createNewLogger = false;
            boolean foundCaller = false;

            Exception ex = new Exception();
            StackTraceElement[] ste = ex.getStackTrace();
            Class<?> caller = null;

            int i = 0;

            while (!foundCaller && i < ste.length) {
                StackTraceElement s = ste[i++];

                // A) look for com.ibm.ws.bootstrap.WsLogManager.getLogger
                if (s.getClassName().equals(CLASS_NAME) && s.getMethodName().equals("getLogger")) {
                    // B) java.util.logging.Logger.getLogger
                    while (!foundCaller && i < ste.length) {
                        s = ste[i++];
                        if (s.getClassName().equals("java.util.logging.Logger") && s.getMethodName().equals("getLogger")) {
                            createNewLogger = true;
                        } else if (createNewLogger) {
                            caller = StackFinderSingleton.instance.getCaller(i, s.getClassName());
                            foundCaller = caller != null;
                        }
                    }
                }
            }

            if (createNewLogger) {
                try {
                    logger = (Logger) wsLogger.newInstance(name, caller, null);
                    // constructing the new logger will add the logger to the log manager
                    // See the constructor com.ibm.ws.logging.internal.WsLogger.WsLogger(String, Class<?>, String)
                    // This is pretty unfortunate escaping of 'this' out of the constructor, but may be risky to try and fix that.
                    // Instead add a hack here to double check that another thread did not win in creating and adding the WsLogger instance
                    Logger checkLogger = super.getLogger(name);
                    if (checkLogger != null) {
                        // Simply reassign because checkLogger is for sure the one that got added.
                        // Not really sure what it would mean if null was returned from super.getLogger, but do nothing in that case
                        logger = checkLogger;
                    }
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        return logger;
    }
264811
Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
        Logger result = getLogger(name);
        if (result == null) {
            // only allocate the new logger once
            Logger newLogger = new Logger(name, resourceBundleName, caller);
            do {
                if (addLogger(newLogger)) {
                    // We successfully added the new Logger that we
                    // created above so return it without refetching.
                    return newLogger;
                }

                // We didn't add the new Logger that we created above
                // because another thread added a Logger with the same
                // name after our null check above and before our call
                // to addLogger(). We have to refetch the Logger because
                // addLogger() returns a boolean instead of the Logger
                // reference itself. However, if the thread that created
                // the other Logger is not holding a strong reference to
                // the other Logger, then it is possible for the other
                // Logger to be GC'ed after we saw it in addLogger() and
                // before we can refetch it. If it has been GC'ed then
                // we'll just loop around and try again.
                result = getLogger(name);
            } while (result == null);
        }
        return result;
    }
543812
def create_logger(name: str) -> Logger:
    
    logger = logging.getLogger(f"{PACKAGE_NAME}.{name}")
    logger.addHandler(StreamHandler())
    return logger
320345
public static Logger getLogger(String className) {
		if (logType == null) {
			logType = findLogType();
		}
		return new Logger(logType.createLog(className));
	}
1041682
def get_logger(name):
    

    log = logging.getLogger(name)
    if not log.handlers:
        log.addHandler(NullHandler())
    return log
1102006
def get_logger(name=None, level=None, stream=DEFAULT_STREAM,
               clobber_root_handler=True, logger_factory=None,
               wrapper_class=None):
    """"""
    _configure_logger(
        logger_factory=logger_factory,
        wrapper_class=wrapper_class)
    log = structlog.get_logger(name)
    root_logger = logging.root
    if log == root_logger:
        if not _has_streamhandler(root_logger, level=level, stream=stream):
            stream_handler = logging.StreamHandler(stream)
            stream_handler.setLevel(level)
            stream_handler.setFormatter(logging.Formatter(fmt=LOG_FORMAT))
            root_logger.addHandler(stream_handler)
        else:
            if clobber_root_handler:
                for handler in root_logger.handlers:
                    handler.setFormatter(logging.Formatter(fmt=LOG_FORMAT))
    if level:
        log.setLevel(level)
    return log
837049
public static ILogger getLogger(String name) {
        // try the fast path first
        LoggerFactory existingFactory = loggerFactory;
        if (existingFactory != null) {
            return existingFactory.getLogger(name);
        }

        synchronized (FACTORY_LOCK) {
            existingFactory = loggerFactory;
            if (existingFactory != null) {
                return existingFactory.getLogger(name);
            }

            LoggerFactory createdFactory = null;

            final String loggingClass = System.getProperty("hazelcast.logging.class");
            if (!StringUtil.isNullOrEmpty(loggingClass)) {
                createdFactory = tryToCreateLoggerFactory(loggingClass);
            }

            if (createdFactory != null) {
                // hazelcast.logging.class property overrides everything, so it's safe to store the factory for reuse
                loggerFactory = createdFactory;
                loggerFactoryClassOrType = loggingClass;
            } else {
                final String loggingType = System.getProperty("hazelcast.logging.type");
                createdFactory = createLoggerFactory(loggingType);

                if (!StringUtil.isNullOrEmpty(loggingType)) {
                    // hazelcast.logging.type property is the recommended way of configuring the logging, in most setups
                    // the configured value should match with the value passed to newLoggerFactory(), so we store the created
                    // factory for reuse
                    loggerFactory = createdFactory;
                    loggerFactoryClassOrType = loggingType;
                }
            }

            return createdFactory.getLogger(name);
        }
    }
428606
public static Logger createModuleLogger(String name, Logger parent) {
		final Logger logger = Logger.getLogger(name);
		if (parent != null) {
			logger.setParent(parent);
		}
		logger.setUseParentHandlers(true);
		final Level level = getLoggingLevelFromProperties();
		logger.setLevel(level);
		return logger;
	}
1049223
def get_logger():
        
        name = Logr.get_logger_name()
        if name not in Logr.loggers:
            Logr.configure_check()
            Logr.loggers[name] = logging.Logger(name)
            Logr.loggers[name].addHandler(Logr.handler)
        return Logr.loggers[name]