Пример #1
0
def setup_logging_from_options(options):
    """Configure logging according to Anaconda command line/boot options.

    :param options: Anaconda command line/boot options
    """
    if (options.debug or options.updateSrc) and not options.loglevel:
        # debugging means debug logging if an explicit level hasn't been st
        options.loglevel = "debug"

    if options.loglevel and options.loglevel in anaconda_logging.logLevelMap:
        log.info("Switching logging level to %s", options.loglevel)
        level = anaconda_logging.logLevelMap[options.loglevel]
        anaconda_logging.logger.loglevel = level
        anaconda_logging.setHandlersLevel(log, level)
        storage_log = get_storage_logger()
        anaconda_logging.setHandlersLevel(storage_log, level)
        packaging_log = get_packaging_logger()
        anaconda_logging.setHandlersLevel(packaging_log, level)

    if conf.system.can_modify_syslog:
        if options.syslog:
            anaconda_logging.logger.updateRemote(options.syslog)

    if options.remotelog:
        try:
            host, port = options.remotelog.split(":", 1)
            port = int(port)
            anaconda_logging.logger.setup_remotelog(host, port)
        except ValueError:
            log.error("Could not setup remotelog with %s", options.remotelog)
Пример #2
0
def setup_logging_from_options(options):
    """Configure logging according to Anaconda command line/boot options.

    :param options: Anaconda command line/boot options
    """
    if (options.debug or options.updateSrc) and not options.loglevel:
        # debugging means debug logging if an explicit level hasn't been st
        options.loglevel = "debug"

    if options.loglevel and options.loglevel in anaconda_logging.logLevelMap:
        log.info("Switching logging level to %s", options.loglevel)
        level = anaconda_logging.logLevelMap[options.loglevel]
        anaconda_logging.logger.loglevel = level
        anaconda_logging.setHandlersLevel(log, level)
        storage_log = get_storage_logger()
        anaconda_logging.setHandlersLevel(storage_log, level)
        packaging_log = get_packaging_logger()
        anaconda_logging.setHandlersLevel(packaging_log, level)

    if can_touch_runtime_system("syslog setup"):
        if options.syslog:
            anaconda_logging.logger.updateRemote(options.syslog)

    if options.remotelog:
        try:
            host, port = options.remotelog.split(":", 1)
            port = int(port)
            anaconda_logging.logger.setup_remotelog(host, port)
        except ValueError:
            log.error("Could not setup remotelog with %s", options.remotelog)