Clean up logging to conform to guidelines
Correct instances where guidelines are not being followed. Guidelines can be found here: http://docs.openstack.org/developer/oslo.i18n/guidelines.html Some of this is seen by folks implementing new code and results in confusion during reviews. These are mostly trivial changes, but the hope is this will provide good examples so as to avoid that confusion. Also cleaning up case of deprecated LOG.warn called in leiu of LOG.warning as well as redundant cases of formatting an exception inside of LOG.exception. Change-Id: I7decb7bf5f3185f7d26ad99b0cb3475a88d3ec99
This commit is contained in:
parent
091c334db2
commit
a3260e27db
|
@ -143,7 +143,7 @@ def initialize_if_enabled():
|
|||
# listen(). In any case, pull the port number out here.
|
||||
port = sock.getsockname()[1]
|
||||
LOG.info(
|
||||
_LI('Eventlet backdoor listening on %(port)s for process %(pid)d') %
|
||||
_LI('Eventlet backdoor listening on %(port)s for process %(pid)d'),
|
||||
{'port': port, 'pid': os.getpid()}
|
||||
)
|
||||
eventlet.spawn_n(eventlet.backdoor.backdoor_server, sock,
|
||||
|
|
|
@ -84,9 +84,9 @@ class FixedIntervalLoopingCall(LoopingCallBase):
|
|||
break
|
||||
delay = end - start - interval
|
||||
if delay > 0:
|
||||
LOG.warn(_LW('task %(func_name)r run outlasted '
|
||||
'interval by %(delay).2f sec'),
|
||||
{'func_name': self.f, 'delay': delay})
|
||||
LOG.warning(_LW('task %(func_name)r run outlasted '
|
||||
'interval by %(delay).2f sec'),
|
||||
{'func_name': self.f, 'delay': delay})
|
||||
greenthread.sleep(-delay if delay < 0 else 0)
|
||||
except LoopingCallDone as e:
|
||||
self.stop()
|
||||
|
|
|
@ -222,11 +222,11 @@ class PeriodicTasks(object):
|
|||
|
||||
try:
|
||||
task(self, context)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
if raise_on_error:
|
||||
raise
|
||||
LOG.exception(_LE("Error during %(full_task_name)s: %(e)s"),
|
||||
{"full_task_name": full_task_name, "e": e})
|
||||
LOG.exception(_LE("Error during %(full_task_name)s"),
|
||||
{"full_task_name": full_task_name})
|
||||
time.sleep(0)
|
||||
|
||||
return idle_for
|
||||
|
|
|
@ -17,6 +17,7 @@ import threading
|
|||
import eventlet
|
||||
from eventlet import greenpool
|
||||
|
||||
from openstack.common._i18n import _LE
|
||||
from openstack.common import loopingcall
|
||||
|
||||
|
||||
|
@ -98,15 +99,15 @@ class ThreadGroup(object):
|
|||
x.stop()
|
||||
except eventlet.greenlet.GreenletExit:
|
||||
pass
|
||||
except Exception as ex:
|
||||
LOG.exception(ex)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Error stopping thread.'))
|
||||
|
||||
def stop_timers(self):
|
||||
for x in self.timers:
|
||||
try:
|
||||
x.stop()
|
||||
except Exception as ex:
|
||||
LOG.exception(ex)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Error stopping timer.'))
|
||||
self.timers = []
|
||||
|
||||
def stop(self, graceful=False):
|
||||
|
@ -132,8 +133,8 @@ class ThreadGroup(object):
|
|||
x.wait()
|
||||
except eventlet.greenlet.GreenletExit:
|
||||
pass
|
||||
except Exception as ex:
|
||||
LOG.exception(ex)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Error waiting on ThreadGroup.'))
|
||||
current = threading.current_thread()
|
||||
|
||||
# Iterate over a copy of self.threads so thread_done doesn't
|
||||
|
|
Loading…
Reference in New Issue