Provide the root logger.

@param configFactory the factory of configurations.
@param config the logger configuration.
@return the root logger.
552236
@SuppressWarnings("static-method")
	@Singleton
	@Provides
	public Logger provideRootLogger(ConfigurationFactory configFactory, Provider<Log4jIntegrationConfig> config) {
		final Logger root = Logger.getRootLogger();
		// Reroute JUL
		SLF4JBridgeHandler.removeHandlersForRootLogger();
		SLF4JBridgeHandler.install();
		final Log4jIntegrationConfig cfg = config.get();
		if (!cfg.getUseLog4jConfig()) {
			cfg.configureLogger(root);
		}
		return root;
	}
768378
public static FailoverStrategy.Factory loadFailoverStrategy(Configuration config, @Nullable Logger logger) {
		final String strategyParam = config.getString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY);

		if (StringUtils.isNullOrWhitespaceOnly(strategyParam)) {
			if (logger != null) {
				logger.warn("Null config value for {} ; using default failover strategy (full restarts).",
						JobManagerOptions.EXECUTION_FAILOVER_STRATEGY.key());
			}

			return new RestartAllStrategy.Factory();
		}
		else {
			switch (strategyParam.toLowerCase()) {
				case FULL_RESTART_STRATEGY_NAME:
					return new RestartAllStrategy.Factory();

				case PIPELINED_REGION_RESTART_STRATEGY_NAME:
					return new RestartPipelinedRegionStrategy.Factory();

				case INDIVIDUAL_RESTART_STRATEGY_NAME:
					return new RestartIndividualStrategy.Factory();

				default:
					// we could interpret the parameter as a factory class name and instantiate that
					// for now we simply do not support this
					throw new IllegalConfigurationException("Unknown failover strategy: " + strategyParam);
			}
		}
	}
445151
private function configureRootLogger(\n2n\log4php\LoggerHierarchy $hierarchy, $config) {
		$logger = $hierarchy->getRootLogger();
		$this->configureLogger($logger, $config);
	}
1354092
public static Logger getLogger(final String logger)
   {
      LogAdapterFactory adapterFactory = getAdapterFactory();
      return adapterFactory.createLogAdapter(logger);
   }
1060054
private static Logger getOrCreateLogger(final String name) {
		if (name == null || name.length() == 0) {
			return root;
		} else {
			Logger logger = loggers.get(name);
			if (logger == null) {
				Logger parent = getOrCreateLogger(reduce(name));
				logger = new Logger(parent, name);
				loggers.put(name, logger);
			}
			return logger;
		}
	}
540802
public LoggingFraction rootLogger(Level level, String... handlers) {
        rootLogger(new RootLogger().level(level)
                .handlers(handlers));
        return this;
    }
841871
public String getConfigInfo(ModuleConfig config) {
        if (loggingDisabled) {
            return null;
        }
        StringBuilder info = new StringBuilder();

        List<String> methodNames = new ArrayList<>();

        Class currentClass = ProxyUtils.getUnproxiedClass(config.getClass());
        ModuleConfigName moduleConfigName = (ModuleConfigName) currentClass.getAnnotation(ModuleConfigName.class);

        while (currentClass != null &&
                !Object.class.getName().equals(currentClass.getName())) {

            StringBuilder configLogging = new StringBuilder();

            //inspect the other methods of the implementing class
            for (Method currentMethod : currentClass.getDeclaredMethods()) {
                if (!currentMethod.isAnnotationPresent(ConfigEntry.class) ||
                        methodNames.contains(currentMethod.getName())) {
                    continue;
                }

                methodNames.add(currentMethod.getName());

                configLogging.append("   method:\t").append(currentMethod.getName());
                configLogging.append(separator);

                addConfigEntryValue(config, configLogging, currentMethod);

                configLogging.append(separator);
                configLogging.append(separator);
            }

            // Was there anything annotated with @ConfigEntry
            if (configLogging.length() > 0) {

                outputConfigurationName(info, moduleConfigName, currentClass);

                info.append(configLogging);
            }

            // Look into the parent class
            currentClass = currentClass.getSuperclass();
        }

        return info.toString();
    }
10304
protected static void initLogger ()
    {
        // if a custom class was specified as a system property, use that
        Factory factory = createConfiguredFactory();

        // create and a log4j logger if the log4j configuration system property is set
        try {
            if (factory == null && System.getProperty("log4j.configuration") != null) {
                factory = (Factory)Class.forName("com.samskivert.util.Log4JLogger").newInstance();
            }
        } catch (SecurityException se) {
            // in a sandbox, no biggie
        } catch (Throwable t) {
            System.err.println("Unable to instantiate Log4JLogger: " + t);
        }

        // create and a log4j2 logger if the log4j2 configuration system property is set
        try {
            if (factory == null && System.getProperty("log4j.configurationFile") != null) {
                factory = (Factory)Class.forName("com.samskivert.util.Log4J2Logger").newInstance();
            }
        } catch (SecurityException se) {
            // in a sandbox, no biggie
        } catch (Throwable t) {
            System.err.println("Unable to instantiate Log4J2Logger: " + t);
        }

        // lastly, fall back to the Java logging system
        if (factory == null) {
            factory = new JDK14Logger();
        }

        // and finally configure our factory
        setFactory(factory);
    }
1191158
@SuppressWarnings("static-method")
	@Provides
	@Singleton
	public SarlConfig getSarlcConfig(ConfigurationFactory configFactory, Injector injector) {
		final SarlConfig config = SarlConfig.getConfiguration(configFactory);
		injector.injectMembers(config);
		return config;
	}
182433
private Logger createLoggerInstance(String loggerName) throws Exception
    {
        Class loggerClass = getConfiguration().getLoggerClass();
        Logger log = (Logger) ClassHelper.newInstance(loggerClass, String.class, loggerName);
        log.configure(getConfiguration());
        return log;
    }
661884
private BuildLogger createLogger() {
        BuildLogger logger;
        if (args.loggerClassname != null) {
            try {
                logger = ClasspathUtils.newInstance(args.loggerClassname, Main.class.getClassLoader(),
                        BuildLogger.class);
            } catch (final BuildException e) {
                printErrorMessage("The specified logger class " + args.loggerClassname + " could not be used because "
                        + e.getMessage());
                throw new RuntimeException();
            }
        } else {
            logger = new DefaultLogger();
            ((DefaultLogger) logger).useColor(args.useColor);
        }

        logger.setMessageOutputLevel(args.msgOutputLevel);
        logger.setOutputPrintStream(out);
        logger.setErrorPrintStream(err);
        logger.setEmacsMode(args.emacsMode);

        return logger;
    }
169394
public static LoggerContext getContext() {
        try {
            return factory.getContext(FQCN, null, null, true);
        } catch (final IllegalStateException ex) {
            LOGGER.warn(ex.getMessage() + " Using SimpleLogger");
            return new SimpleLoggerContextFactory().getContext(FQCN, null, null, true);
        }
    }
202605
public static LoggerConfig[] setLogLevel(String loggerName, String level) {
    if(StringUtils.isBlank(loggerName)) {
      loggerName = ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME;
    }
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    log.debug("Setting {} to level {}", loggerName, level);
    ch.qos.logback.classic.Logger logger = null;
    try {
      logger = context.getLogger(loggerName);
      if(logger != null) {
        if(level.equals("null") || level.equals("none")) {
          logger.setLevel(null);
        } else {
          logger.setLevel(Level.toLevel(level));
        }
        logger = context.getLogger(loggerName);
        return new LoggerConfig[] {new LoggerConfig(logger.getName(), logger.getLevel() + "")};
      }
      return new LoggerConfig[] {};
    } catch(Throwable t) {
      log.warn("Failed to change log level for logger "+loggerName+" to level "+level, t);
      return new LoggerConfig[] {};
    }
  }
360036
def configure_logging(conf):
    """"""
    root_logger = logging.getLogger()
    root_logger.setLevel(getattr(logging, conf.loglevel.upper()))
    if conf.logtostderr:
        add_stream_handler(root_logger, sys.stderr)
    if conf.logtostdout:
        add_stream_handler(root_logger, sys.stdout)
251807
public Logger get_logger() {
	if (logger == null) {
	    logger = Logger.getLogger(get_name().toLowerCase());
	    logger.setAdditivity(false);
	    logger.setLevel(Level.WARN);
	    last_level = Level.WARN;
	}
	return logger;
    }
23181
private void parseLoggingConfig(final Node node, final ConfigSettings config)
	{

		String name;
		String value;
		Node nnode;
		NodeList list = node.getChildNodes();

		int length = list.getLength();
		for (int i = 0; i < length; i++) {
			nnode = list.item(i);

			name = nnode.getNodeName().toUpperCase();
			if (name.equals(KEY_ROOT_FOLDER)) {

				value = nnode.getChildNodes().item(0).getNodeValue();
				value = value.substring(1, value.length() - 1);

				config.setConfigParameter(
						ConfigurationKeys.LOGGING_PATH_DIFFTOOL, value);

			}
			else if (name.equals(SUBSUBSECTION_DIFF_TOOL)) {

				parseLoggerConfig(nnode, config, null,
						ConfigurationKeys.LOGGING_LOGLEVEL_DIFFTOOL);

			}
		}
	}
1276639
private void configureWithWrapperWritingToFile(LoggerContext ctx) {
    // configure all logs (ie. root logger) to be written to console with formatting
    // in practice, this will be only APP's own logs as logs from sub processes are written to LOGGER_GOBBLER and
    // LOGGER_GOBBLER is configured below to be detached from root
    // logs are written to the console because we want them to be in sonar.log and the wrapper will write any log
    // from APP's System.out and System.err to sonar.log
    Logger rootLogger = ctx.getLogger(ROOT_LOGGER_NAME);
    rootLogger.addAppender(createAppConsoleAppender(ctx, helper.buildLogPattern(APP_ROOT_LOGGER_CONFIG)));

    // in regular configuration, sub processes are not copying their logs to their System.out, so, the only logs to be
    // expected in LOGGER_GOBBLER are those before logback is setup in subprocesses or when JVM crashes
    // so, they must be printed to App's System.out as is (as they are already formatted) and the wrapper will write
    // them to sonar.log
    // logger is configured to be non additive as we don't want these logs written to sonar.log and duplicated in the
    // console with an incorrect formatting
    configureGobbler(ctx);
  }