1
0
Fork 0
mirror of synced 2024-05-29 16:40:06 +12:00

Catch error when logfile accessed concurrently

This commit is contained in:
Serene-Arc 2021-04-27 12:54:30 +10:00
parent 667aa395e5
commit db46676dec

View file

@ -203,7 +203,13 @@ class RedditDownloader:
backupCount=backup_count,
)
if log_path.exists():
file_handler.doRollover()
try:
file_handler.doRollover()
except PermissionError as e:
logger.critical(
'Cannot rollover logfile, make sure this is the only '
'BDFR process or specify alternate logfile location')
raise
formatter = logging.Formatter('[%(asctime)s - %(name)s - %(levelname)s] - %(message)s')
file_handler.setFormatter(formatter)
file_handler.setLevel(0)