diff options
| author | Thierry Carrez <thierry@openstack.org> | 2011-01-21 16:24:39 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-01-21 16:24:39 +0000 |
| commit | 977393fe3e487926899f3f64cfd33f39105cc97e (patch) | |
| tree | eeed0c2e7e11fd3f5be31575ff394390a7b05d2e | |
| parent | 14edbd55e667b16b8d46c0230b11ccd964f5742f (diff) | |
| parent | 2042c8722910c1f22ba04636163841812b3e24ba (diff) | |
| download | nova-977393fe3e487926899f3f64cfd33f39105cc97e.tar.gz nova-977393fe3e487926899f3f64cfd33f39105cc97e.tar.xz nova-977393fe3e487926899f3f64cfd33f39105cc97e.zip | |
Change default log formats so that:
* they include a timestamp (necessary to correlate logs)
* no longer display version on every line (shorter lines)
* use [-] instead of [N/A] (shorter lines, less scary-looking)
* show level before logger name (better human-readability)
Display version once at node startup time instead.
Fix description of the log format flags.
| -rwxr-xr-x | bin/nova-api | 3 | ||||
| -rw-r--r-- | nova/log.py | 8 | ||||
| -rw-r--r-- | nova/service.py | 4 |
3 files changed, 10 insertions, 5 deletions
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) diff --git a/nova/log.py b/nova/log.py index 4997d3f28..e1c9f46f4 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' 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) |
