Log traceback on errors in Watcher

This commit makes sure exception is logged with traceback when an error
happened in Watcher (e.g. when processing the event).

Change-Id: I54909622dae5e05e63576e4b504650b6c3fcb5c5
This commit is contained in:
Michał Dulko 2018-08-01 14:30:14 +02:00
parent 6bc68ce6c2
commit 6c3a73cc67
1 changed files with 4 additions and 3 deletions

View File

@ -191,9 +191,10 @@ class Watcher(health.HealthHandler):
self._idle[path] = True
if not (self._running and path in self._resources):
return
except Exception as e:
LOG.warning("Restarting(%s) watching '%s': %s",
attempts, path, e)
except Exception:
LOG.exception("Caught exception while watching.")
LOG.warning("Restarting(%s) watching '%s'.",
attempts, path)
attempts += 1
retry = True
self._idle[path] = True