Fix config processing for oslo.log

Change-Id: Ib63cf80560f7d9a0a6dc9c4e04015b098511d4a5
This commit is contained in:
Ilya Shakhat 2015-03-03 17:38:25 +03:00
parent d9da219ff8
commit a8e50eacc4
11 changed files with 99 additions and 108 deletions

View File

@ -2,4 +2,4 @@
output_file = etc/shaker.conf
wrap_width = 79
namespace = shaker.engine.config
namespace = shaker.openstack.common.log
namespace = oslo_log

View File

@ -1,5 +1,88 @@
[DEFAULT]
#
# From oslo_log
#
# Print debugging output (set logging level to DEBUG instead of default WARNING
# level). (boolean value)
#debug = false
# Print more verbose output (set logging level to INFO instead of default
# WARNING level). (boolean value)
#verbose = false
# The name of a logging configuration file. This file is appended to any
# existing logging configuration files. For details about logging configuration
# files, see the Python logging module documentation. (string value)
# Deprecated group/name - [DEFAULT]/log_config
#log_config_append = <None>
# DEPRECATED. A logging.Formatter log message format string which may use any
# of the available logging.LogRecord attributes. This option is deprecated.
# Please use logging_context_format_string and logging_default_format_string
# instead. (string value)
#log_format = <None>
# Format string for %%(asctime)s in log records. Default: %(default)s . (string
# value)
#log_date_format = %Y-%m-%d %H:%M:%S
# (Optional) Name of log file to output to. If no default is set, logging will
# go to stdout. (string value)
# Deprecated group/name - [DEFAULT]/logfile
#log_file = <None>
# (Optional) The base directory used for relative --log-file paths. (string
# value)
# Deprecated group/name - [DEFAULT]/logdir
#log_dir = <None>
# Use syslog for logging. Existing syslog format is DEPRECATED during I, and
# will change in J to honor RFC5424. (boolean value)
#use_syslog = false
# (Optional) Enables or disables syslog rfc5424 format for logging. If enabled,
# prefixes the MSG part of the syslog message with APP-NAME (RFC5424). The
# format without the APP-NAME is deprecated in I, and will be removed in J.
# (boolean value)
#use_syslog_rfc_format = false
# Syslog facility to receive log lines. (string value)
#syslog_log_facility = LOG_USER
# Log output to standard error. (boolean value)
#use_stderr = true
# Format string to use for log messages with context. (string value)
#logging_context_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s
# Format string to use for log messages without context. (string value)
#logging_default_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
# Data to append to log format when level is DEBUG. (string value)
#logging_debug_format_suffix = %(funcName)s %(pathname)s:%(lineno)d
# Prefix each line of exception output with this format. (string value)
#logging_exception_prefix = %(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s
# List of logger=LEVEL pairs. (list value)
#default_log_levels = amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,urllib3.connectionpool=WARN,websocket=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN
# Enables or disables publication of error events. (boolean value)
#publish_errors = false
# Enables or disables fatal status of deprecations. (boolean value)
#fatal_deprecations = false
# The format for an instance that is passed with the log message. (string
# value)
#instance_format = "[instance: %(uuid)s] "
# The format for an instance UUID that is passed with the log message. (string
# value)
#instance_uuid_format = "[instance: %(uuid)s] "
#
# From shaker.engine.config
#
@ -46,7 +129,7 @@
#scenario = <None>
# Report template in Jinja format (string value)
#report_template = shaker/resources/report_template.html
#report_template = shaker/resources/report_template.jinja2
# Report file name. If not specified print to stdout (string value)
#report = <None>
@ -64,98 +147,3 @@
# Heat template for the image builder. (string value)
#image_builder_template = shaker/resources/image_builder_template.yaml
#
# From shaker.openstack.common.log
#
# Print debugging output (set logging level to DEBUG instead of default WARNING
# level). (boolean value)
#debug = false
# Print more verbose output (set logging level to INFO instead of default
# WARNING level). (boolean value)
#verbose = false
#
# From shaker.openstack.common.log
#
# The name of a logging configuration file. This file is appended to any
# existing logging configuration files. For details about logging configuration
# files, see the Python logging module documentation. (string value)
# Deprecated group/name - [DEFAULT]/log_config
#log_config_append = <None>
# DEPRECATED. A logging.Formatter log message format string which may use any
# of the available logging.LogRecord attributes. This option is deprecated.
# Please use logging_context_format_string and logging_default_format_string
# instead. (string value)
#log_format = <None>
# Format string for %%(asctime)s in log records. Default: %(default)s . (string
# value)
#log_date_format = %Y-%m-%d %H:%M:%S
# (Optional) Name of log file to output to. If no default is set, logging will
# go to stdout. (string value)
# Deprecated group/name - [DEFAULT]/logfile
#log_file = <None>
# (Optional) The base directory used for relative --log-file paths. (string
# value)
# Deprecated group/name - [DEFAULT]/logdir
#log_dir = <None>
# Use syslog for logging. Existing syslog format is DEPRECATED during I, and
# will change in J to honor RFC5424. (boolean value)
#use_syslog = false
# (Optional) Enables or disables syslog rfc5424 format for logging. If enabled,
# prefixes the MSG part of the syslog message with APP-NAME (RFC5424). The
# format without the APP-NAME is deprecated in I, and will be removed in J.
# (boolean value)
#use_syslog_rfc_format = false
# Syslog facility to receive log lines. (string value)
#syslog_log_facility = LOG_USER
#
# From shaker.openstack.common.log
#
# Log output to standard error. (boolean value)
#use_stderr = true
#
# From shaker.openstack.common.log
#
# Format string to use for log messages with context. (string value)
#logging_context_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s
# Format string to use for log messages without context. (string value)
#logging_default_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
# Data to append to log format when level is DEBUG. (string value)
#logging_debug_format_suffix = %(funcName)s %(pathname)s:%(lineno)d
# Prefix each line of exception output with this format. (string value)
#logging_exception_prefix = %(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s
# List of logger=LEVEL pairs. (list value)
#default_log_levels = amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,urllib3.connectionpool=WARN,websocket=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN
# Enables or disables publication of error events. (boolean value)
#publish_errors = false
# Enables or disables fatal status of deprecations. (boolean value)
#fatal_deprecations = false
# The format for an instance that is passed with the log message. (string
# value)
#instance_format = "[instance: %(uuid)s] "
# The format for an instance UUID that is passed with the log message. (string
# value)
#instance_uuid_format = "[instance: %(uuid)s] "

View File

@ -30,7 +30,7 @@ console_scripts =
shaker-cleanup = shaker.engine.image_builder:cleanup
oslo.config.opts =
shaker.openstack.common.log = shaker.openstack.common.log:list_opts
oslo_log = oslo_log._options:list_opts
shaker.engine.config = shaker.engine.config:list_opts
[build_sphinx]

View File

@ -60,6 +60,8 @@ def main():
conf.register_cli_opts(config.AGENT_OPTS)
conf.register_opts(config.COMMON_OPTS)
conf.register_opts(config.AGENT_OPTS)
logging.register_options(conf)
logging.set_defaults()
try:
conf(project='shaker')
@ -68,7 +70,7 @@ def main():
conf.print_usage()
exit(1)
logging.setup('shaker')
logging.setup(conf, 'shaker')
LOG.info('Logging enabled')
endpoint = cfg.CONF.server_endpoint

View File

@ -64,7 +64,7 @@ SERVER_OPTS = [
help='Scenario file name'),
cfg.StrOpt('report-template',
default='shaker/resources/report_template.html',
default='shaker/resources/report_template.jinja2',
help='Report template in Jinja format'),
cfg.StrOpt('report',
help='Report file name. If not specified print to stdout'),

View File

@ -37,9 +37,11 @@ def init():
conf.register_cli_opts(config.IMAGE_BUILDER_OPTS)
conf.register_opts(config.OPENSTACK_OPTS)
conf.register_opts(config.IMAGE_BUILDER_OPTS)
logging.register_options(conf)
logging.set_defaults()
conf(project='shaker')
logging.setup('shaker')
logging.setup(conf, 'shaker')
LOG.info('Logging enabled')
openstack_client = openstack.OpenStackClient(

View File

@ -203,6 +203,8 @@ def main():
conf.register_opts(config.COMMON_OPTS)
conf.register_opts(config.OPENSTACK_OPTS)
conf.register_opts(config.SERVER_OPTS)
logging.register_options(conf)
logging.set_defaults()
try:
conf(project='shaker')
@ -211,7 +213,7 @@ def main():
conf.print_usage()
exit(1)
logging.setup('shaker')
logging.setup(conf, 'shaker')
LOG.info('Logging enabled')
scenario = read_scenario()

View File

@ -16,8 +16,7 @@
import time
from heatclient import client as heat_client_pkg
from shaker.openstack.common import log as logging
from oslo_log import log as logging
LOG = logging.getLogger(__name__)

View File

@ -14,8 +14,7 @@
# limitations under the License.
from neutronclient.neutron import client as neutron_client_pkg
from shaker.openstack.common import log as logging
from oslo_log import log as logging
LOG = logging.getLogger(__name__)

View File

@ -16,8 +16,7 @@
import time
from novaclient import client as nova_client_pkg
from shaker.openstack.common import log as logging
from oslo_log import log as logging
LOG = logging.getLogger(__name__)