Пример #1
0
def setup_logging():
    log_file = cfg.CONF.network_log.local_output_log_base
    if log_file:
        from logging import handlers as watch_handler
        log_file_handler = watch_handler.WatchedFileHandler(log_file)
        LOG.logger.addHandler(log_file_handler)
    elif cfg.CONF.use_journal:
        journal_handler = handlers.OSJournalHandler()
        LOG.logger.addHandler(journal_handler)
    else:
        syslog_handler = handlers.OSSysLogHandler()
        LOG.logger.addHandler(syslog_handler)
Пример #2
0
def setup_logging():

    log_file = cfg.CONF.network_log.local_output_log_base
    if log_file:
        import logging
        log_file_handler = logging.handlers.WatchedFileHandler(log_file)
        log_file_handler.setLevel(logging.INFO)
        log_file_handler.setFormatter(
            logging.Formatter(fmt="%(asctime)s %(message)s",
                              datefmt=cfg.CONF.log_date_format))
        LOG.logger.addHandler(log_file_handler)
    elif cfg.CONF.use_journal:
        journal_handler = handlers.OSJournalHandler()
        LOG.logger.addHandler(journal_handler)
    else:
        syslog_handler = handlers.OSSysLogHandler()
        LOG.logger.addHandler(syslog_handler)
Пример #3
0
def setup_logging():
    log_file = cfg.CONF.network_log.local_output_log_base
    if log_file:
        from logging import handlers as watch_handler
        log_file_handler = watch_handler.WatchedFileHandler(log_file)
        log_file_handler.setLevel(
            logging.DEBUG if cfg.CONF.debug else logging.INFO)
        LOG.logger.addHandler(log_file_handler)
        log_file_handler.setFormatter(
            formatters.ContextFormatter(
                fmt=cfg.CONF.logging_default_format_string,
                datefmt=cfg.CONF.log_date_format))
    elif cfg.CONF.use_journal:
        journal_handler = handlers.OSJournalHandler()
        LOG.logger.addHandler(journal_handler)
    else:
        syslog_handler = handlers.OSSysLogHandler()
        LOG.logger.addHandler(syslog_handler)