diff options
Diffstat (limited to 'src/logger.py')
-rw-r--r-- | src/logger.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/logger.py b/src/logger.py index 85c7a746..7efa8f61 100644 --- a/src/logger.py +++ b/src/logger.py @@ -25,9 +25,7 @@ import logging log = logging.getLogger(__name__) -from config import LOG_DIR - -log_dir = os.path.join(LOG_DIR, 'logs') +from config import LOG_DIR as log_dir message_log_re = re.compile(r'MR (\d{4})(\d{2})(\d{2})T' r'(\d{2}):(\d{2}):(\d{2})Z ' @@ -119,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 |