Check the named logger for an appropriate existing StreamHandler.

    This only returns True if a StreamHandler that exaclty matches
    our specification is found. If other StreamHandlers are seen,
    we assume they were added for a different purpose.
340976
def _has_streamhandler(logger, level=None, fmt=LOG_FORMAT,
                       stream=DEFAULT_STREAM):
    
    # Ensure we are talking the same type of logging levels
    # if they passed in a string we need to convert it to a number
    if isinstance(level, basestring):
        level = logging.getLevelName(level)

    for handler in logger.handlers:
        if not isinstance(handler, logging.StreamHandler):
            continue
        if handler.stream is not stream:
            continue
        if handler.level != level:
            continue
        if not handler.formatter or handler.formatter._fmt != fmt:
            continue
        return True
    return False
551914
private boolean isMonitorAccessibleFromClassLoader(ClassLoader loader) {
        if (loader == null) {
            return false;
        }
        boolean isMonitorAccessible = true;
        InputStream monitorInputStream = null;
        try {
            monitorInputStream = loader.getResourceAsStream(COVERAGE_MONITOR_RESOURCE);
            if (monitorInputStream == null) {
                isMonitorAccessible = false;
            }
        } catch (Exception ex1) {
            isMonitorAccessible = false;
            try {
                if (monitorInputStream != null) {
                    monitorInputStream.close();
                }
            } catch (IOException ex2) {
                // do nothing
            }
        }
        return isMonitorAccessible;
    }
874335
def get_logger(cls, custom_name=None):
        """"""
        name = custom_name or cls.get_name()
        return logging.getLogger(name)
1097253
function (name, loggerContext) {
    /**
     * Logger name
     */
    this.name = name;

    /**
     * Reference to the logger context that created this logger
     *
     * The reference is used to create appenders and layouts when
     * configuration is applied.
     */
    this.loggerContext = loggerContext;

    /**
     * Parent logger. All loggers have a parent except the root logger
     */
    this.parent = null;

    /**
     * Children loggers. Mostly used during initialization to propagate
     * the configuration.
     */
    this.children = [];

    /**
     * Appenders associated with the logger. Set during initialization
     */
    this.appenders = [];

    /**
     * Logger filter. Set during initialization
     */
    this.filter = null;

    /**
     * The trace level of the logger. Log events whose level is below that
     * level are logged. Others are discarded.
     */
    this.level = 'inherit';

    /**
     * Additivity flag. Log events are not propagated to the parent logger
     * if the flag is not set.
     */
    this.additive = true;

    /**
     * Function used to determine whether a log level is below the
     * trace level of the logger
     */
    if (this.loggerContext) {
      this.isBelow = function (level, referenceLevel) {
        return this.loggerContext.logLevel.isBelow(level, referenceLevel);
      };

      // Set trace functions for all registered levels
      utils.each(this.loggerContext.logLevel.getLevels(), function (level) {
        var self = this;
        if (!this[level]) {
          this[level] = function () {
            self.traceAtLevel(level, arguments);
          };
        }
      }, this);
    }
    else {
      this.isBelow = function () {
        return true;
      };
    }
  }
190926
protected function getMonologHandler()
  {
    $name = Str::slug($this->getNamespaceName());
    return (new StreamHandler($this->storagePath("logs/{$name}.log"), Logger::DEBUG))
      ->setFormatter(new LineFormatter(null, null, true, true));
  }
451633
def get_modernrpc_logger(name):
    """"""
    logger = logging.getLogger(name)
    if not logger_has_handlers(logger):
        # If logging is not configured in the current project, configure this logger to discard all logs messages.
        # This will prevent the 'No handlers could be found for logger XXX' error on Python 2,
        # and avoid redirecting errors to the default 'lastResort' StreamHandler on Python 3
        logger.addHandler(logging.NullHandler())
    return logger
582227
public boolean hasLogger(final String name, final Class<? extends MessageFactory> messageFactoryClass) {
        return getOrCreateInnerMap(factoryClassKey(messageFactoryClass)).containsKey(name);
    }
104688
public boolean validateWatcher(String name, Watcher watcher){
        synchronized(watchers){
            if(watchers.containsKey(name)){
                return watchers.get(name).contains(watcher);
            }
            return false;
        }
    }
48040
public boolean isLogger(String loggerName) throws Exception {
        Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName);
        return null != readResource(addr);
    }
45903
public static ProcessHandler getDefaultHandler(Logger logger) {
    return LegacyProcessHandler.builder()
        .addStdErrLineListener(logger::lifecycle)
        .addStdOutLineListener(logger::lifecycle)
        .setExitListener(new NonZeroExceptionExitListener())
        .build();
  }
1262072
public static Logger getLogger(String name) {
    if (name == null) {
      throw new NullPointerException("Logger name may not be null.");
    }
    init();
    return (instance.internalGetLogger(name));
  }
1319874
def remove_logging_handler(handler, logger=None):
    

    logger = LOGGER if logger is None else logger
    logger.handlers and LOGGER.debug("> Stopping handler: '{0}'.".format(handler))
    logger.removeHandler(handler)
    return True
1151217
@SuppressWarnings("unchecked")
    private void checkForProblemsWithLoggerMethods() throws ClassNotFoundException {
        String callingClsName = getClassConstantOperand();
        if (!(callingClsName.endsWith("Log") || (callingClsName.endsWith("Logger"))) || (stack.getStackDepth() == 0)) {
            return;
        }
        String sig = getSigConstantOperand();
        if (SIG_STRING_AND_THROWABLE_TO_VOID.equals(sig) || SIG_OBJECT_AND_THROWABLE_TO_VOID.equals(sig)) {
            checkForProblemsWithLoggerThrowableMethods();
        } else if (SignatureBuilder.SIG_OBJECT_TO_VOID.equals(sig)) {
            checkForProblemsWithLoggerSingleArgumentMethod();
        } else if ((SLF4J_LOGGER.equals(callingClsName) || LOG4J2_LOGGER.equals(callingClsName))
                && (SignatureBuilder.SIG_STRING_TO_VOID.equals(sig) || SignatureBuilder.SIG_STRING_AND_OBJECT_TO_VOID.equals(sig)
                        || SIG_STRING_AND_TWO_OBJECTS_TO_VOID.equals(sig) || SIG_STRING_AND_OBJECT_ARRAY_TO_VOID.equals(sig))) {
            checkForProblemsWithLoggerParameterisedMethods(sig);
        }
    }
590495
protected boolean checkHandler(ZoneHandlerClass handler, ApiZone apiZone) {
        return apiZone.getName().startsWith(handler.getZoneName());
    }
18503
def get_logger(
        name, file_name=None, stream=None, template=None, propagate=False):
    

    logger = logging.getLogger(name)

    if propagate is not None:
        logger.propagate = propagate

    for handler in logger.handlers:
        logger.removeHandler(handler)

    if not template:
        template = "%(name)s %(process)s %(levelname)s %(message)s"

    formatter = logging.Formatter(template)

    if not file_name and not stream:
        stream = sys.stdout

    handlers = []

    if stream is not None:

        handlers.append(logging.StreamHandler(stream=stream))

    if file_name is not None:

        if os.path.isdir(os.path.dirname(file_name)):
            handlers.append(logging.FileHandler(file_name))
        else:
            print("ERROR: Can't open log file {}".format(file_name))

    for ch in handlers:
        ch.setFormatter(formatter)
        logger.addHandler(ch)

    logger.setLevel(logging.INFO)

    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]
788629
def _configure_logger_handler(cls, log_dest, log_filename):
        

        if log_dest is None:
            return None

        msg_format = '%(asctime)s-%(name)s-%(message)s'

        if log_dest == 'stderr':
            # Note: sys.stderr is the default stream for StreamHandler
            handler = logging.StreamHandler()
            handler.setFormatter(logging.Formatter(msg_format))
        elif log_dest == 'file':
            if not log_filename:
                raise ValueError("Log filename is required if log destination "
                                 "is 'file'")
            handler = logging.FileHandler(log_filename, encoding="UTF-8")
            handler.setFormatter(logging.Formatter(msg_format))
        else:
            raise ValueError(
                _format("Invalid log destination: {0!A}; Must be one of: "
                        "{1!A}", log_dest, LOG_DESTINATIONS))

        return handler