diff --git a/zerver/lib/remote_server.py b/zerver/lib/remote_server.py index 7877e663f8..e445217850 100644 --- a/zerver/lib/remote_server.py +++ b/zerver/lib/remote_server.py @@ -161,7 +161,7 @@ def send_analytics_to_remote_server() -> None: try: result = send_to_push_bouncer("GET", "server/analytics/status", {}) except PushNotificationBouncerRetryLaterError as e: - logging.warning(e.msg) + logging.warning(e.msg, exc_info=True) return last_acked_realm_count_id = result["last_realm_count_id"] diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.py index 4a6a105fd5..55d98eaf2d 100644 --- a/zerver/tests/test_push_notifications.py +++ b/zerver/tests/test_push_notifications.py @@ -571,13 +571,12 @@ class AnalyticsBouncerTest(BouncerTestCase): user = self.example_user("hamlet") end_time = self.TIME_ZERO - with responses.RequestsMock() as resp, mock.patch( - "zerver.lib.remote_server.logging.warning" - ) as mock_warning: + with responses.RequestsMock() as resp, self.assertLogs(level="WARNING") as mock_warning: resp.add(responses.GET, ANALYTICS_STATUS_URL, body=ConnectionError()) send_analytics_to_remote_server() - mock_warning.assert_called_once_with( - "ConnectionError while trying to connect to push notification bouncer" + self.assertIn( + "WARNING:root:ConnectionError while trying to connect to push notification bouncer\nTraceback ", + mock_warning.output[0], ) self.assertTrue(resp.assert_call_count(ANALYTICS_STATUS_URL, 1))