private Optional<Pair<Resource, LoggerContext>> buildLoggerContext() {
        val logFile = applicationContext.getEnvironment().getProperty("logging.config", "classpath:/log4j2.xml");
        LOGGER.info("Located logging configuration reference in the environment as [{}]", logFile);
        if (ResourceUtils.doesResourceExist(logFile, applicationContext)) {
            val configFile = applicationContext.getResource(logFile);
            LOGGER.trace("Loaded logging configuration resource [{}]. Initializing logger context...", configFile);
            val context = FunctionUtils.doUnchecked(() -> Configurator.initialize("CAS", null, configFile.getURI()));
            LOGGER.trace("Installing log configuration listener to detect changes and update");
            context.getConfiguration().addListener(reconfigurable -> context.updateLoggers(reconfigurable.reconfigure()));
            return Optional.of(Pair.of(configFile, context));
        }
        LOGGER.warn("Logging configuration cannot be found in the environment settings");
        return Optional.empty();
    }
Gets log entries.

@param count the count
@param level the level
@return the log entries
core/cas-server-core-logging/src/main/java/org/apereo/cas/logging/web/LoggingConfigurationEndpoint.java