From 9770a40e5fcbff4e08b5e4e11f9f9772667f59b6 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 6 May 2015 00:49:11 +0200 Subject: [PATCH] =?UTF-8?q?When=20reading=20logs,=20don=E2=80=99t=20consid?= =?UTF-8?q?er=20a=20non-existing=20file=20as=20an=20error.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/logger.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/logger.py b/src/logger.py index 1a46f5e5..7efa8f61 100644 --- a/src/logger.py +++ b/src/logger.py @@ -117,10 +117,15 @@ class Logger(object): try: fd = open(os.path.join(log_dir, jid), 'rb') - except: + except FileNotFoundError: + log.info('Non-existing log file (%s)', + os.path.join(log_dir, jid), + exc_info=True) + return + except OSError: log.error('Unable to open the log file (%s)', - os.path.join(log_dir, jid), - exc_info=True) + os.path.join(log_dir, jid), + exc_info=True) return if not fd: return