Add simple file loggin to ovs_quantum_agent.

Default behaviour is retained. Fix bug #1016232

Change-Id: If11244d48a5c966bbbf8786e3e9f42d205a70164
This commit is contained in:
Armando Migliaccio 2012-06-21 21:21:17 +01:00
parent 7841b681f1
commit 163d15b383
3 changed files with 12 additions and 0 deletions

View 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]

View File

@ -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

View 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),
]