示例#1
0
    def execute(self):
        if anaconda_logging.logger.loglevel == anaconda_logging.DEFAULT_LEVEL:
            # not set from the command line
            level = anaconda_logging.logLevelMap[self.level]
            anaconda_logging.logger.loglevel = level
            # set log level for the "anaconda" root logger
            anaconda_logging.setHandlersLevel(get_anaconda_root_logger(), level)
            # set log level for the storage logger
            anaconda_logging.setHandlersLevel(storage_log, level)

        if anaconda_logging.logger.remote_syslog is None and len(self.host) > 0:
            # not set from the command line, ok to use kickstart
            remote_server = self.host
            if self.port:
                remote_server = "%s:%s" % (self.host, self.port)
            anaconda_logging.logger.updateRemote(remote_server)
示例#2
0
    def execute(self):
        if anaconda_logging.logger.loglevel == anaconda_logging.DEFAULT_LEVEL:
            # not set from the command line
            level = anaconda_logging.logLevelMap[self.level]
            anaconda_logging.logger.loglevel = level
            # set log level for the "anaconda" root logger
            anaconda_logging.setHandlersLevel(get_anaconda_root_logger(),
                                              level)

        if anaconda_logging.logger.remote_syslog is None and len(
                self.host) > 0:
            # not set from the command line, ok to use kickstart
            remote_server = self.host
            if self.port:
                remote_server = "%s:%s" % (self.host, self.port)
            anaconda_logging.logger.updateRemote(remote_server)
示例#3
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)
示例#4
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)
示例#5
0
def setup_logging_from_kickstart(data):
    """Configure logging according to the kickstart.

    :param data: kickstart data
    """
    level = data.logging.level
    host = data.logging.host
    port = data.logging.port

    if anaconda_logging.logger.loglevel == anaconda_logging.DEFAULT_LEVEL:
        # not set from the command line
        level = anaconda_logging.logLevelMap[level]
        anaconda_logging.logger.loglevel = level
        # set log level for the "anaconda" root logger
        anaconda_logging.setHandlersLevel(get_anaconda_root_logger(), level)

    if anaconda_logging.logger.remote_syslog is None and len(host) > 0:
        # not set from the command line, ok to use kickstart
        remote_server = host
        if port:
            remote_server = "%s:%s" % (host, port)
        anaconda_logging.logger.updateRemote(remote_server)