This sample configuration file demonstrates how the OpenStack compute service (nova) might be configured.
# nova_sample.conf
[loggers]
keys = root, nova
[handlers]
keys = stderr, stdout, watchedfile, syslog, null
[formatters]
keys = context, default
[logger_root]
level = WARNING
handlers = null
[logger_nova]
level = INFO
handlers = stderr
qualname = nova
[logger_amqp]
level = WARNING
handlers = stderr
qualname = amqp
[logger_amqplib]
level = WARNING
handlers = stderr
qualname = amqplib
[logger_sqlalchemy]
level = WARNING
handlers = stderr
qualname = sqlalchemy
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARNING" logs neither. (Recommended for production systems.)
[logger_boto]
level = WARNING
handlers = stderr
qualname = boto
# NOTE(mikal): suds is used by the vmware driver, removing this will
# cause many extraneous log lines for their tempest runs. Refer to
# https://review.openstack.org/#/c/219225/ for details.
[logger_suds]
level = INFO
handlers = stderr
qualname = suds
[logger_eventletwsgi]
level = WARNING
handlers = stderr
qualname = eventlet.wsgi.server
[handler_stderr]
class = StreamHandler
args = (sys.stderr,)
formatter = context
[handler_stdout]
class = StreamHandler
args = (sys.stdout,)
formatter = context
[handler_watchedfile]
class = handlers.WatchedFileHandler
args = ('nova.log',)
formatter = context
[handler_syslog]
class = handlers.SysLogHandler
args = ('/dev/log', handlers.SysLogHandler.LOG_USER)
formatter = context
[handler_null]
class = logging.NullHandler
formatter = default
args = ()
[formatter_context]
class = oslo_log.formatters.ContextFormatter
[formatter_default]
format = %(message)s
Two logger nodes are set up, root and nova.
[loggers]
keys = root, nova
Several handlers are created, to send messages to different outputs.
[handlers]
keys = stderr, stdout, watchedfile, syslog, null
And two formatters are created to be used based on whether the logging location will have OpenStack request context information available or not.
[formatters]
keys = context, default
The root logger is configured to send messages to the null handler, silencing most messages that are not part of the nova application code namespace.
[logger_root]
level = WARNING
handlers = null
The nova logger is configured to send messages marked as INFO and higher level to the standard error stream.
[logger_nova]
level = INFO
handlers = stderr
qualname = nova
The amqp and amqplib loggers, used by the module that connects the application to the message bus, are configured to emit warning messages to the standard error stream.
[logger_amqp]
level = WARNING
handlers = stderr
qualname = amqp
[logger_amqplib]
level = WARNING
handlers = stderr
qualname = amqplib
The sqlalchemy logger, used by the module that connects the application to the database, is configured to emit warning messages to the standard error stream.
[logger_sqlalchemy]
level = WARNING
handlers = stderr
qualname = sqlalchemy
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARNING" logs neither. (Recommended for production systems.)
Similarly, boto, suds, and eventlet.wsgi.server are configured to send warnings to the standard error stream.
[logger_boto]
level = WARNING
handlers = stderr
qualname = boto
# NOTE(mikal): suds is used by the vmware driver, removing this will
# cause many extraneous log lines for their tempest runs. Refer to
# https://review.openstack.org/#/c/219225/ for details.
[logger_suds]
level = INFO
handlers = stderr
qualname = suds
[logger_eventletwsgi]
level = WARNING
handlers = stderr
qualname = eventlet.wsgi.server
The stderr handler, being used by most of the loggers above, is configured to write to the standard error stream on the console.
[handler_stderr]
class = StreamHandler
args = (sys.stderr,)
formatter = context
The stderr handler uses the context formatter, which takes its configuration settings from oslo.config.
[formatter_context]
class = oslo_log.formatters.ContextFormatter
The stdout and syslog handlers are defined, but not used.