本文整理汇总了Python中oslo_log.log.setup方法的典型用法代码示例。如果您正苦于以下问题:Python log.setup方法的具体用法?Python log.setup怎么用?Python log.setup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oslo_log.log
的用法示例。
在下文中一共展示了log.setup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_application
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def init_application():
conf_files = _get_config_files()
logging.register_options(cfg.CONF)
cfg.CONF([], project='designate', default_config_files=conf_files)
config.set_defaults()
logging.setup(cfg.CONF, 'designate')
policy.init()
if not rpc.initialized():
rpc.init(CONF)
heartbeat = heartbeat_emitter.get_heartbeat_emitter('api')
heartbeat.start()
conf = conf_files[0]
return deploy.loadapp('config:%s' % conf, name='osapi_dns')
示例2: setup
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def setup(product_name):
log.setup(CONF, product_name)
if CONF.logging_serial_port_settings:
try:
serialportlog = SerialPortHandler()
log_root = log.getLogger(product_name).logger
log_root.addHandler(serialportlog)
datefmt = CONF.log_date_format
serialportlog.setFormatter(
formatters.ContextFormatter(project=product_name,
datefmt=datefmt))
except serial.SerialException:
LOG.warn("Serial port: {0} could not be opened".format(
CONF.logging_serial_port_settings))
示例3: _log_setup
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def _log_setup(self):
CONF = cfg.CONF
self.set_request_context()
DOMAIN = "masakari"
CONF.log_file = self.conf_log.get("log_file")
CONF.use_stderr = False
logging.register_options(CONF)
logging.setup(CONF, DOMAIN)
log_dir = os.path.dirname(self.conf_log.get("log_file"))
# create log dir if not created
try:
os.makedirs(log_dir)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(log_dir):
pass
else:
raise
return
示例4: configure_wsgi
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def configure_wsgi():
# NOTE(hberaud): Call reset to ensure the ConfigOpts object doesn't
# already contain registered options if the app is reloaded.
CONF.reset()
config.parse_args()
config.set_config_defaults()
logging.setup(CONF, 'searchlight')
gmr.TextGuruMeditation.setup_autorun(version)
utils.register_plugin_opts()
# Fail fast if service policy files aren't found
service_policies.check_policy_files()
if CONF.profiler.enabled:
_notifier = osprofiler.notifier.create("Messaging",
notifier.messaging, {},
notifier.get_transport(),
"searchlight", "search",
CONF.api.bind_host)
osprofiler.notifier.set(_notifier)
else:
osprofiler.web.disable()
示例5: main
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def main():
log.register_options(CONF)
gmr_opts.set_defaults(CONF)
CONF(sys.argv[1:], project='manila',
version=version.version_string())
log.setup(CONF, "manila")
utils.monkey_patch()
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
launcher = service.process_launcher()
if CONF.enabled_share_backends:
for backend in CONF.enabled_share_backends:
host = "%s@%s" % (CONF.host, backend)
server = service.Service.create(host=host,
service_name=backend,
binary='manila-share',
coordination=True)
launcher.launch_service(server)
else:
server = service.Service.create(binary='manila-share')
launcher.launch_service(server)
launcher.wait()
示例6: setUp
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def setUp(self):
super(LogLevelTestCase, self).setUp()
levels = self.CONF.default_log_levels
info_level = 'nova-test'
warn_level = 'nova-not-debug'
other_level = 'nova-below-debug'
trace_level = 'nova-trace'
levels.append(info_level + '=INFO')
levels.append(warn_level + '=WARN')
levels.append(other_level + '=7')
levels.append(trace_level + '=TRACE')
self.config(default_log_levels=levels)
log.setup(self.CONF, 'testing')
self.log = log.getLogger(info_level)
self.log_no_debug = log.getLogger(warn_level)
self.log_below_debug = log.getLogger(other_level)
self.log_trace = log.getLogger(trace_level)
示例7: main
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def main():
api_config.parse_args(sys.argv)
logging.setup(CONF, "masakari")
log = logging.getLogger(__name__)
objects.register_all()
launcher = service.process_launcher()
try:
server = service.WSGIService("masakari_api", use_ssl=CONF.use_ssl)
launcher.launch_service(server, workers=server.workers or 1)
except exception.PasteAppNotFound as ex:
log.error("Failed to start ``masakari_api`` service. Error: %s",
six.text_type(ex))
sys.exit(1)
launcher.wait()
示例8: initialize_application
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def initialize_application():
conf_files = _get_config_files()
api_config.parse_args([], default_config_files=conf_files)
logging.setup(CONF, "masakari")
objects.register_all()
CONF(sys.argv[1:], project='masakari', version=version.version_string())
# NOTE: Dump conf at debug (log_options option comes from oslo.service)
# This is gross but we don't have a public hook into oslo.service to
# register these options, so we are doing it manually for now;
# remove this when we have a hook method into oslo.service.
CONF.register_opts(service_opts.service_opts)
if CONF.log_options:
CONF.log_opt_values(logging.getLogger(__name__), logging.DEBUG)
config.set_middleware_defaults()
rpc.init(CONF)
conf = conf_files[0]
return deploy.loadapp('config:%s' % conf, name="masakari_api")
示例9: main_app
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def main_app(func):
def _wrapper(global_config, **local_conf):
# Queuing initialization
queue.init(CONF, is_server_side=False)
# Configure oslo logging and configuration services.
log.setup(CONF, 'barbican')
config.setup_remote_pydev_debug()
# Initializing the database engine and session factory before the app
# starts ensures we don't lose requests due to lazy initialization of
# db connections.
repositories.setup_database_engine_and_factory()
wsgi_app = func(global_config, **local_conf)
if newrelic_loaded:
wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app)
LOG = log.getLogger(__name__)
LOG.info(u._LI('Barbican app created and initialized'))
return wsgi_app
return _wrapper
示例10: main
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def main():
try:
CONF = config.CONF
# Import and configure logging.
log.setup(CONF, 'barbican')
LOG = log.getLogger(__name__)
LOG.debug("Booting up Barbican worker node...")
# Queuing initialization
queue.init(CONF)
service.launch(
CONF,
server.TaskServer(),
workers=CONF.queue.asynchronous_workers
).wait()
except RuntimeError as e:
fail(1, e)
示例11: main
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def main():
try:
CONF = config.CONF
# Import and configure logging.
log.setup(CONF, 'barbican-retry-scheduler')
LOG = log.getLogger(__name__)
LOG.debug("Booting up Barbican worker retry/scheduler node...")
# Queuing initialization (as a client only).
queue.init(CONF, is_server_side=False)
service.launch(
CONF,
retry_scheduler.PeriodicServer()
).wait()
except RuntimeError as e:
fail(1, e)
示例12: main
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def main():
try:
CONF = config.CONF
CONF(sys.argv[1:], project='barbican',
version=version.version_info.version_string)
# Import and configure logging.
log.setup(CONF, 'barbican')
LOG = log.getLogger(__name__)
LOG.debug("Booting up Barbican worker node...")
# Queuing initialization
queue.init(CONF)
service.launch(
CONF,
server.TaskServer(),
workers=CONF.queue.asynchronous_workers,
restart_method='mutate'
).wait()
except RuntimeError as e:
fail(1, e)
示例13: prepare_service
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def prepare_service(argv=None):
if argv is None:
argv = []
log.register_options(CONF)
config.parse_args(argv)
config.set_config_defaults()
log.setup(CONF, 'zun')
# TODO(yuanying): Uncomment after objects are implemented
# objects.register_all()
示例14: main
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def main():
config.parse_args(sys.argv)
logging.setup(config.CONF, "ec2api")
server = s3server.get_wsgi_server()
service.serve(server)
service.wait()
示例15: main
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import setup [as 别名]
def main():
CONF.register_cli_opt(command_opt)
config.parse_args(sys.argv)
log.setup(CONF, "ec2api")
try:
CONF.command.func()
except Exception as e:
sys.exit("ERROR: %s" % e)