summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-08-10 21:00:39 +0000
committerGerrit Code Review <review@openstack.org>2018-08-10 21:00:39 +0000
commit4b59e0fbfb94c02d09f775a65e3452158d1d9a83 (patch)
tree5fde181584abd34626a7fcbc4cea283a4d743c91
parente72de8843b4575a901eb67646d02d2a829dadfa9 (diff)
parentf937dd2a150f77f9c3de489acdafe2bdce13fdbe (diff)
Merge "Fix no packet log data when debug is set False in configuration"
-rw-r--r--neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py b/neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py
index 029e9db..67aae68 100644
--- a/neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py
+++ b/neutron/services/logapi/drivers/openvswitch/ovs_firewall_log.py
@@ -17,6 +17,7 @@ import collections
17 17
18from neutron_lib import constants as lib_const 18from neutron_lib import constants as lib_const
19from oslo_config import cfg 19from oslo_config import cfg
20from oslo_log import formatters
20from oslo_log import handlers 21from oslo_log import handlers
21from oslo_log import log as logging 22from oslo_log import log as logging
22from ryu.base import app_manager 23from ryu.base import app_manager
@@ -50,7 +51,13 @@ def setup_logging():
50 if log_file: 51 if log_file:
51 from logging import handlers as watch_handler 52 from logging import handlers as watch_handler
52 log_file_handler = watch_handler.WatchedFileHandler(log_file) 53 log_file_handler = watch_handler.WatchedFileHandler(log_file)
54 log_file_handler.setLevel(
55 logging.DEBUG if cfg.CONF.debug else logging.INFO)
53 LOG.logger.addHandler(log_file_handler) 56 LOG.logger.addHandler(log_file_handler)
57 log_file_handler.setFormatter(
58 formatters.ContextFormatter(
59 fmt=cfg.CONF.logging_default_format_string,
60 datefmt=cfg.CONF.log_date_format))
54 elif cfg.CONF.use_journal: 61 elif cfg.CONF.use_journal:
55 journal_handler = handlers.OSJournalHandler() 62 journal_handler = handlers.OSJournalHandler()
56 LOG.logger.addHandler(journal_handler) 63 LOG.logger.addHandler(journal_handler)
@@ -164,12 +171,12 @@ class OVSFirewallLoggingDriver(log_ext.LoggingDriver):
164 pkt = packet.Packet(msg.data) 171 pkt = packet.Packet(msg.data)
165 try: 172 try:
166 cookie_entry = self._get_cookie_by_id(cookie_id) 173 cookie_entry = self._get_cookie_by_id(cookie_id)
167 LOG.debug("action=%s project_id=%s log_resource_ids=%s vm_port=%s " 174 LOG.info("action=%s project_id=%s log_resource_ids=%s vm_port=%s "
168 "pkt=%s", cookie_entry.action, cookie_entry.project, 175 "pkt=%s", cookie_entry.action, cookie_entry.project,
169 list(cookie_entry.log_object_refs), 176 list(cookie_entry.log_object_refs),
170 cookie_entry.port, pkt) 177 cookie_entry.port, pkt)
171 except log_exc.CookieNotFound: 178 except log_exc.CookieNotFound:
172 LOG.debug("Unknown cookie=%s packet_in pkt=%s", cookie_id, pkt) 179 LOG.warning("Unknown cookie=%s packet_in pkt=%s", cookie_id, pkt)
173 180
174 def defer_apply_on(self): 181 def defer_apply_on(self):
175 self._deferred = True 182 self._deferred = True