]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Print version info at start
authorIan Wienand <iwienand@redhat.com>
Thu, 4 Dec 2014 00:31:23 +0000 (11:31 +1100)
committerIan Wienand <iwienand@redhat.com>
Mon, 8 Dec 2014 00:47:31 +0000 (11:47 +1100)
When debugging problems from logs, it would be useful to know what
version is running across program start and stop.  In one case I have
a suspicion that an upgrade was run inbetween but the logs don't help
identify that.

My first thought was to grab this from argparse just as --version
does, but that's not really currently possible [1].

The original starting message is probably irrelevant, but I realise
log messages tend to suffer from Hotel California syndrome; you can
check-in but you can never leave.

[1] http://bugs.python.org/issue9399

Change-Id: Ia1bfd2f3589b508e19fd8a94d59beaafd6d657d2

neutron/common/config.py

index f8bd3949fe145a4b19ea73af5d15bd191f916959..5f45854292aed70260c1e8f469415848ac657087 100644 (file)
@@ -18,6 +18,7 @@ Routines for configuring Neutron
 """
 
 import os
+import sys
 
 from oslo.config import cfg
 from oslo.db import options as db_options
@@ -163,6 +164,10 @@ def setup_logging():
     product_name = "neutron"
     logging.setup(product_name)
     LOG.info(_LI("Logging enabled!"))
+    LOG.info(_LI("%(prog)s version %(version)s"),
+             {'prog': sys.argv[0],
+              'version': version.version_info.release_string()})
+    LOG.debug("command line: %s" % " ".join(sys.argv))
 
 
 def load_paste_app(app_name):