def __init__(self, epm, config): super(LogManager, self).__init__() # self.config = config self.event_queue = [] self.log_configuration(config) self.logger = logging.getLogger(__name__) log_setup.setup_loggers(verbose_level=config['Verbose'], capture_std_output=False)
def __init__(self, epm, config): super(LogManager, self).__init__() # self.config = config self.event_queue = [] self.log_configuration(config) self.logger = logging.getLogger(__name__) log_setup.setup_loggers( verbose_level=config['Verbose'], capture_std_output=False)
"LogConfigFile instead" sys.exit(1) if 'LogFile' in cfg: print >>sys.stderr, "LogFile is no longer supported, use " \ "LogConfigFile instead" sys.exit(1) daemonize = cfg.get('Daemonize', False) if daemonize: verbose_level = 0 else: verbose_level = cfg['Verbose'] log_configuration(cfg) log_setup.setup_loggers(verbose_level=verbose_level, capture_std_output=daemonize) for key, value in cfg.iteritems(): logger.debug("CONFIG: %s = %s", key, value) logger.info('validator started with arguments: %s', sys.argv) check_elevated = cfg.get('CheckElevated') if check_elevated is False: logger.debug("check for elevated (root/admin) privileges " "is disabled") else: if os.name == "posix": is_admin = os.getuid() == 0 elif os.name == "nt": is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
except InvalidSubstitutionKey, e: print >> sys.stderr, str(e) sys.exit(1) if 'LogLevel' in cfg: print >>sys.stderr, "LogLevel is no longer supported, use " \ "LogConfigFile instead" sys.exit(1) if 'LogFile' in cfg: print >>sys.stderr, "LogFile is no longer supported, use " \ "LogConfigFile instead" sys.exit(1) log_configuration(cfg) log_setup.setup_loggers(cfg["Verbose"]) if "KeyFile" in cfg: keyfile = cfg["KeyFile"] if os.path.isfile(keyfile): logger.info('read signing key from %s', keyfile) key = read_key_file(keyfile) cfg['SigningKey'] = key else: logger.warn('unable to find key file %s', keyfile) else: logger.warn('no key file specified') local_main(cfg)
def read_key_file(keyfile): with open(keyfile, "r") as fd: key = fd.read().strip() return key def main(args=sys.argv[1:]): try: cfg = get_configuration(args) except ConfigFileNotFound, e: print >> sys.stderr, str(e) sys.exit(1) except InvalidSubstitutionKey, e: print >> sys.stderr, str(e) sys.exit(1) log_setup.setup_loggers(cfg) if "KeyFile" in cfg: keyfile = cfg["KeyFile"] if os.path.isfile(keyfile): logger.info('read signing key from %s', keyfile) key = read_key_file(keyfile) cfg['SigningKey'] = key else: logger.warn('unable to find key file %s', keyfile) else: logger.warn('no key file specified') local_main(cfg)
except InvalidSubstitutionKey, e: print >> sys.stderr, str(e) sys.exit(1) if 'LogLevel' in cfg: print >>sys.stderr, "LogLevel is no longer supported, use " \ "LogConfigFile instead" sys.exit(1) if 'LogFile' in cfg: print >>sys.stderr, "LogFile is no longer supported, use " \ "LogConfigFile instead" sys.exit(1) log_configuration(cfg) log_setup.setup_loggers(cfg["Verbose"]) if "KeyFile" in cfg: keyfile = cfg["KeyFile"] if os.path.isfile(keyfile): logger.info('read signing key from %s', keyfile) key = read_key_file(keyfile) cfg['SigningKey'] = key else: logger.warn('unable to locate key file %s', keyfile) else: logger.warn('no key file specified') local_main(cfg)
sys.exit(1) if 'LogFile' in cfg: print >>sys.stderr, "LogFile is no longer supported, use " \ "LogConfigFile instead" sys.exit(1) daemonize = cfg.get('Daemonize', False) if daemonize: verbose_level = 0 else: verbose_level = cfg['Verbose'] log_configuration(cfg) log_setup.setup_loggers( verbose_level=verbose_level, capture_std_output=daemonize) for key, value in cfg.iteritems(): logger.debug("CONFIG: %s = %s", key, value) logger.info('validator started with arguments: %s', sys.argv) if not os.path.exists(cfg["DataDirectory"]): warnings.warn("Data directory does not exist: {}".format( cfg["DataDirectory"])) sys.exit(1) if "KeyFile" in cfg: keyfile = cfg["KeyFile"] if os.path.isfile(keyfile):
servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, '')) main([], windows_service=True) def main(args, windows_service=False): try: cfg = get_configuration(args) except ConfigFileNotFound, e: print >> sys.stderr, str(e) sys.exit(1) except InvalidSubstitutionKey, e: print >> sys.stderr, str(e) sys.exit(1) log_setup.setup_loggers(cfg, cfg['Verbose']) for key, value in cfg.iteritems(): logger.debug("CONFIG: %s = %s", key, value) logger.info('validator started with arguments: %s', sys.argv) logger.warn('validator pid is %s', os.getpid()) if not os.path.exists(cfg["DataDirectory"]): warnings.warn("Data directory does not exist: {}".format( cfg["DataDirectory"])) sys.exit(1) if "KeyFile" in cfg: keyfile = cfg["KeyFile"] if os.path.isfile(keyfile):