diff --git a/google/cloud/pubsub_v1/subscriber/_protocol/heartbeater.py b/google/cloud/pubsub_v1/subscriber/_protocol/heartbeater.py index 7fa964ff6..a053d5fe4 100644 --- a/google/cloud/pubsub_v1/subscriber/_protocol/heartbeater.py +++ b/google/cloud/pubsub_v1/subscriber/_protocol/heartbeater.py @@ -48,7 +48,7 @@ def heartbeat(self) -> None: _LOGGER.debug("Sent heartbeat.") self._stop_event.wait(timeout=self._period) - _LOGGER.info("%s exiting.", _HEARTBEAT_WORKER_NAME) + _LOGGER.debug("%s exiting.", _HEARTBEAT_WORKER_NAME) def start(self) -> None: with self._operational_lock: diff --git a/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py b/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py index dc2b14fc6..508f4d7ce 100644 --- a/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py +++ b/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py @@ -212,7 +212,7 @@ def maintain_leases(self) -> None: _LOGGER.debug("Snoozing lease management for %f seconds.", snooze) self._stop_event.wait(timeout=snooze) - _LOGGER.info("%s exiting.", _LEASE_WORKER_NAME) + _LOGGER.debug("%s exiting.", _LEASE_WORKER_NAME) def start(self) -> None: with self._operational_lock: diff --git a/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py b/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py index 894c41b4c..f7e44cb7f 100644 --- a/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py +++ b/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py @@ -743,7 +743,7 @@ def heartbeat(self) -> bool: request = gapic_types.StreamingPullRequest( stream_ack_deadline_seconds=self.ack_deadline ) - _LOGGER.info( + _LOGGER.debug( "Sending new ack_deadline of %d seconds.", self.ack_deadline ) else: @@ -1081,9 +1081,9 @@ def _should_recover(self, exception: BaseException) -> bool: # If this is in the list of idempotent exceptions, then we want to # recover. if isinstance(exception, _RETRYABLE_STREAM_ERRORS): - _LOGGER.info("Observed recoverable stream error %s", exception) + _LOGGER.debug("Observed recoverable stream error %s", exception) return True - _LOGGER.info("Observed non-recoverable stream error %s", exception) + _LOGGER.debug("Observed non-recoverable stream error %s", exception) return False def _should_terminate(self, exception: BaseException) -> bool: @@ -1101,9 +1101,9 @@ def _should_terminate(self, exception: BaseException) -> bool: """ exception = _wrap_as_exception(exception) if isinstance(exception, _TERMINATING_STREAM_ERRORS): - _LOGGER.info("Observed terminating stream error %s", exception) + _LOGGER.debug("Observed terminating stream error %s", exception) return True - _LOGGER.info("Observed non-terminating stream error %s", exception) + _LOGGER.debug("Observed non-terminating stream error %s", exception) return False def _on_rpc_done(self, future: Any) -> None: @@ -1117,7 +1117,7 @@ def _on_rpc_done(self, future: Any) -> None: with shutting everything down. This is to prevent blocking in the background consumer and preventing it from being ``joined()``. """ - _LOGGER.info("RPC termination has signaled streaming pull manager shutdown.") + _LOGGER.debug("RPC termination has signaled streaming pull manager shutdown.") error = _wrap_as_exception(future) thread = threading.Thread( name=_RPC_ERROR_THREAD_NAME, target=self._shutdown, kwargs={"reason": error} diff --git a/samples/snippets/subscriber.py b/samples/snippets/subscriber.py index a642bf03a..2967b5254 100644 --- a/samples/snippets/subscriber.py +++ b/samples/snippets/subscriber.py @@ -771,14 +771,14 @@ def synchronous_pull_with_lease_management( "ack_deadline_seconds": 15, } ) - logger.info(f"Reset ack deadline for {msg_data}.") + logger.debug(f"Reset ack deadline for {msg_data}.") # If the process is complete, acknowledge the message. else: subscriber.acknowledge( request={"subscription": subscription_path, "ack_ids": [ack_id]} ) - logger.info(f"Acknowledged {msg_data}.") + logger.debug(f"Acknowledged {msg_data}.") processes.pop(process) print( f"Received and acknowledged {len(response.received_messages)} messages from {subscription_path}." diff --git a/tests/unit/pubsub_v1/subscriber/test_leaser.py b/tests/unit/pubsub_v1/subscriber/test_leaser.py index 890c3c947..ccc3ec99f 100644 --- a/tests/unit/pubsub_v1/subscriber/test_leaser.py +++ b/tests/unit/pubsub_v1/subscriber/test_leaser.py @@ -89,7 +89,7 @@ def create_manager(flow_control=types.FlowControl()): def test_maintain_leases_inactive_manager(caplog): - caplog.set_level(logging.INFO) + caplog.set_level(logging.DEBUG) manager = create_manager() manager.is_active = False @@ -107,7 +107,7 @@ def test_maintain_leases_inactive_manager(caplog): def test_maintain_leases_stopped(caplog): - caplog.set_level(logging.INFO) + caplog.set_level(logging.DEBUG) manager = create_manager() leaser_ = leaser.Leaser(manager) diff --git a/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py b/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py index ad1647119..ab21a1597 100644 --- a/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py +++ b/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py @@ -1036,7 +1036,7 @@ def test_heartbeat_inactive(): def test_heartbeat_stream_ack_deadline_seconds(caplog): - caplog.set_level(logging.INFO) + caplog.set_level(logging.DEBUG) manager = make_manager() manager._rpc = mock.create_autospec(bidi.BidiRpc, instance=True) manager._rpc.is_active = True