diff --git a/locust/clients.py b/locust/clients.py index 460ff6ad2b..6198450fdf 100644 --- a/locust/clients.py +++ b/locust/clients.py @@ -1,6 +1,7 @@ from __future__ import annotations import re import time +import logging from contextlib import contextmanager from typing import Generator, Optional from urllib.parse import urlparse, urlunparse @@ -16,6 +17,8 @@ absolute_http_url_regexp = re.compile(r"^https?://", re.I) +logger = logging.getLogger(__name__) + class LocustResponse(Response): def raise_for_status(self): @@ -178,7 +181,8 @@ def _send_request_safe_mode(self, method, url, **kwargs): """ try: return super().request(method, url, **kwargs) - except (MissingSchema, InvalidSchema, InvalidURL): + except (MissingSchema, InvalidSchema, InvalidURL) as e: + logger.log(logging.CRITICAL, str(e)) raise except RequestException as e: r = LocustResponse()