From a9c8ef031780636dd851095f0e76dabeb9eed487 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Thu, 20 Jan 2011 12:20:50 +0100 Subject: Add timestamp to default log format, invert name and level for better readability, log version once at startup --- nova/log.py | 10 +++++----- nova/service.py | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/nova/log.py b/nova/log.py index 4997d3f28..d021561bb 100644 --- a/nova/log.py +++ b/nova/log.py @@ -40,15 +40,15 @@ from nova import version FLAGS = flags.FLAGS flags.DEFINE_string('logging_context_format_string', - '(%(name)s %(nova_version)s): %(levelname)s ' + '%(asctime)s %(levelname)s %(name)s ' '[%(request_id)s %(user)s ' '%(project)s] %(message)s', - 'format string to use for log messages') + 'format string to use for log messages with context') flags.DEFINE_string('logging_default_format_string', - '(%(name)s %(nova_version)s): %(levelname)s [N/A] ' + '%(asctime)s %(levelname)s %(name)s [-] ' '%(message)s', - 'format string to use for log messages') + 'format string to use for log messages without context') flags.DEFINE_string('logging_debug_format_suffix', 'from %(processName)s (pid=%(process)d) %(funcName)s' @@ -56,7 +56,7 @@ flags.DEFINE_string('logging_debug_format_suffix', 'data to append to log format when level is DEBUG') flags.DEFINE_string('logging_exception_prefix', - '(%(name)s): TRACE: ', + '%(asctime)s TRACE %(name)s: ', 'prefix each line of exception output with this format') flags.DEFINE_list('default_log_levels', diff --git a/nova/service.py b/nova/service.py index efc08fd63..91e00d3d1 100644 --- a/nova/service.py +++ b/nova/service.py @@ -38,6 +38,7 @@ from nova import log as logging from nova import flags from nova import rpc from nova import utils +from nova import version FLAGS = flags.FLAGS @@ -156,7 +157,8 @@ class Service(object): report_interval = FLAGS.report_interval if not periodic_interval: periodic_interval = FLAGS.periodic_interval - logging.audit(_("Starting %s node"), topic) + logging.audit(_("Starting %s node (version %s)"), topic, + version.version_string_with_vcs()) service_obj = cls(host, binary, topic, manager, report_interval, periodic_interval) -- cgit From 6ef429d425b82db6dc87fa40241d97bea897bd23 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Thu, 20 Jan 2011 12:26:19 +0100 Subject: Also print version at nova-api startup, for consistency --- bin/nova-api | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/nova-api b/bin/nova-api index 7b4fbeab1..44bbfaf86 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -36,6 +36,7 @@ gettext.install('nova', unicode=1) from nova import flags from nova import log as logging +from nova import version from nova import wsgi logging.basicConfig() @@ -79,6 +80,8 @@ def run_app(paste_config_file): if __name__ == '__main__': FLAGS(sys.argv) + LOG.audit(_("Starting nova-api node (version %s)"), + version.version_string_with_vcs()) conf = wsgi.paste_config_file('nova-api.conf') if conf: run_app(conf) -- cgit From 2042c8722910c1f22ba04636163841812b3e24ba Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Thu, 20 Jan 2011 15:12:02 +0100 Subject: Keep exception tracing as it was --- nova/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/log.py b/nova/log.py index d021561bb..e1c9f46f4 100644 --- a/nova/log.py +++ b/nova/log.py @@ -56,7 +56,7 @@ flags.DEFINE_string('logging_debug_format_suffix', 'data to append to log format when level is DEBUG') flags.DEFINE_string('logging_exception_prefix', - '%(asctime)s TRACE %(name)s: ', + '(%(name)s): TRACE: ', 'prefix each line of exception output with this format') flags.DEFINE_list('default_log_levels', -- cgit