mirror of
https://github.com/logos-messaging/logos-messaging-interop-tests.git
synced 2026-01-08 17:03:12 +00:00
log fix
This commit is contained in:
parent
14e28439bb
commit
8335f8f1e5
@ -64,9 +64,10 @@ class DockerManager:
|
|||||||
|
|
||||||
def _log_container_output(self, container, log_path):
|
def _log_container_output(self, container, log_path):
|
||||||
os.makedirs(os.path.dirname(log_path), exist_ok=True)
|
os.makedirs(os.path.dirname(log_path), exist_ok=True)
|
||||||
|
retry_count = 0
|
||||||
|
start_time = time.time()
|
||||||
try:
|
try:
|
||||||
with open(log_path, "wb+") as log_file:
|
with open(log_path, "wb+") as log_file:
|
||||||
start_time = time.time()
|
|
||||||
while True:
|
while True:
|
||||||
if container.status in ["exited", "dead"]:
|
if container.status in ["exited", "dead"]:
|
||||||
logger.info(f"Container {container.short_id} has stopped. Exiting log stream.")
|
logger.info(f"Container {container.short_id} has stopped. Exiting log stream.")
|
||||||
@ -77,13 +78,19 @@ class DockerManager:
|
|||||||
log_file.write(chunk)
|
log_file.write(chunk)
|
||||||
log_file.flush()
|
log_file.flush()
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
retry_count = 0
|
||||||
else:
|
else:
|
||||||
if time.time() - start_time > 10:
|
if time.time() - start_time > 5:
|
||||||
logger.error(f"Log stream timeout for container {container.short_id}")
|
logger.warning(f"Log stream timeout for container {container.short_id}")
|
||||||
return
|
return
|
||||||
except (APIError, IOError) as e:
|
except (APIError, IOError) as e:
|
||||||
logger.error(f"Error while reading logs from container {container.short_id}: {e}")
|
retry_count += 1
|
||||||
time.sleep(1)
|
if retry_count >= 5:
|
||||||
|
logger.error(f"Max retries reached for container {container.short_id}. Exiting log stream.")
|
||||||
|
return
|
||||||
|
time.sleep(0.2)
|
||||||
|
except Exception as e:
|
||||||
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to set up logging for container {container.short_id}: {e}")
|
logger.error(f"Failed to set up logging for container {container.short_id}: {e}")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user