]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add simple file loggin to ovs_quantum_agent.
authorArmando Migliaccio <amigliaccio@internap.com>
Thu, 21 Jun 2012 20:21:17 +0000 (21:21 +0100)
committerArmando Migliaccio <amigliaccio@internap.com>
Tue, 26 Jun 2012 16:31:27 +0000 (17:31 +0100)
Default behaviour is retained. Fix bug #1016232

Change-Id: If11244d48a5c966bbbf8786e3e9f42d205a70164

etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini
quantum/plugins/openvswitch/agent/ovs_quantum_agent.py
quantum/plugins/openvswitch/common/config.py

index 349347a251fa6437dd0bd80cbb6199c76dbc60e8..32625712063219ea5698c403f7ccdaed5fb48119 100644 (file)
@@ -51,6 +51,8 @@ root_helper = sudo
 # integration_bridge = br-int
 # [AGENT]
 # root_helper = sudo
+# Add the following setting, if you want to log to a file
+# log_file = /var/log/quantum/ovs_quantum_agent.log
 #
 # 2. With tunneling.
 # [DATABASE]
index 9c94f9807b740ad5df014fe284cf0030ba2eefa0..a11f43e069e058c199e6eff04673f8bbd56d961e 100755 (executable)
@@ -523,6 +523,15 @@ def main():
     config_file = args[0]
     conf = config.parse(config_file)
 
+    if conf.AGENT.log_file:
+        # Avoid to redirect traces to stdout/stderr
+        logging.getLogger().handlers = []
+        handler = logging.FileHandler(conf.AGENT.log_file)
+        formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
+        handler.setFormatter(formatter)
+        LOG.addHandler(handler)
+        LOG.debug('Verbose: %s', options.verbose)
+
     # Determine which agent type to use.
     enable_tunneling = conf.OVS.enable_tunneling
     integ_br = conf.OVS.integration_bridge
index c0f7680f639195a187e25d29afd3f3e07ced97f9..88a579880757a09d00734050dfe2a67cf936037e 100644 (file)
@@ -34,6 +34,7 @@ ovs_opts = [
 agent_opts = [
     cfg.IntOpt('polling_interval', default=2),
     cfg.StrOpt('root_helper', default='sudo'),
+    cfg.StrOpt('log_file', default=None),
 ]