From: Ian Wienand Date: Thu, 4 Dec 2014 00:31:23 +0000 (+1100) Subject: Print version info at start X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=44eed735187d8b29319e70ea4872ee53346fe6a0;p=openstack-build%2Fneutron-build.git Print version info at start 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 --- diff --git a/neutron/common/config.py b/neutron/common/config.py index f8bd3949f..5f4585429 100644 --- a/neutron/common/config.py +++ b/neutron/common/config.py @@ -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):