diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a66278a..3b8d57d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] ### Added +- Check for parent `RPClient` object in thread before logging, by @HardNorth + +## [5.3.3] +### Added - `RPClient.clone()` method, by @HardNorth ### Fixed - Client crash in case of Client ID reading error, by @HardNorth diff --git a/reportportal_client/logs/__init__.py b/reportportal_client/logs/__init__.py index 96ae238a..269018ed 100644 --- a/reportportal_client/logs/__init__.py +++ b/reportportal_client/logs/__init__.py @@ -14,12 +14,13 @@ import logging import sys +import threading from six import PY2 from six.moves.urllib.parse import urlparse # noinspection PyProtectedMember -from reportportal_client._local import current +from reportportal_client._local import current, set_current from reportportal_client.helpers import timestamp @@ -177,6 +178,11 @@ def emit(self, record): rp_client = self.rp_client if not rp_client: rp_client = current() + if not rp_client: + rp_client = getattr(threading.current_thread(), + 'parent_rp_client', None) + if rp_client: + set_current(rp_client) if rp_client: rp_client.log( timestamp(), diff --git a/setup.py b/setup.py index 1ad9dfc3..af687580 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages -__version__ = '5.3.3' +__version__ = '5.3.4' TYPE_STUBS = ['*.pyi']