diff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.py index bddb566aa..baa14f166 100644 --- a/src/documents/management/commands/document_consumer.py +++ b/src/documents/management/commands/document_consumer.py @@ -67,17 +67,19 @@ def _consume(filepath): read_try_count = 0 file_open_ok = False + os_error_str = None while (read_try_count < os_error_retry_count) and not file_open_ok: try: with open(filepath, "rb"): file_open_ok = True - except OSError: + except OSError as e: read_try_count += 1 + os_error_str = str(e) sleep(os_error_retry_wait) if read_try_count >= os_error_retry_count: - logger.warning(f"Not consuming file {filepath}: OS reports file as busy still") + logger.warning(f"Not consuming file {filepath}: OS reports {os_error_str}") return tag_ids = None