diff --git a/cassandra/cluster.py b/cassandra/cluster.py index e71b6acb..3880b07b 100644 --- a/cassandra/cluster.py +++ b/cassandra/cluster.py @@ -688,7 +688,7 @@ class Cluster(object): host.set_down() - log.warn("Host %s has been marked down", host) + log.warning("Host %s has been marked down", host) self.load_balancing_policy.on_down(host) self.control_connection.on_down(host) @@ -734,7 +734,7 @@ class Cluster(object): return if not all(futures_results): - log.warn("Connection pool could not be created, not marking node %s up", host) + log.warning("Connection pool could not be created, not marking node %s up", host) return self._finalize_add(host) @@ -873,9 +873,9 @@ class Cluster(object): log.debug("Done preparing all known prepared statements against host %s", host) except OperationTimedOut as timeout: - log.warn("Timed out trying to prepare all statements on host %s: %s", host, timeout) + log.warning("Timed out trying to prepare all statements on host %s: %s", host, timeout) except (ConnectionException, socket.error) as exc: - log.warn("Error trying to prepare all statements on host %s: %r", host, exc) + log.warning("Error trying to prepare all statements on host %s: %r", host, exc) except Exception: log.exception("Error trying to prepare all statements on host %s", host) finally: @@ -1233,7 +1233,7 @@ class Session(object): self.cluster.signal_connection_failure(host, conn_exc, is_host_addition) return False except Exception as conn_exc: - log.warn("Failed to create connection pool for new host %s: %s", host, conn_exc) + log.warning("Failed to create connection pool for new host %s: %s", host, conn_exc) self.cluster.signal_connection_failure(host, conn_exc, is_host_addition) return False @@ -1428,11 +1428,11 @@ class ControlConnection(object): return self._try_connect(host) except ConnectionException as exc: errors[host.address] = exc - log.warn("[control connection] Error connecting to %s:", host, exc_info=True) + log.warning("[control connection] Error connecting to %s:", host, exc_info=True) self._cluster.signal_connection_failure(host, exc, is_host_addition=False) except Exception as exc: errors[host.address] = exc - log.warn("[control connection] Error connecting to %s:", host, exc_info=True) + log.warning("[control connection] Error connecting to %s:", host, exc_info=True) raise NoHostAvailable("Unable to connect to any servers", errors) @@ -1859,7 +1859,7 @@ class _Scheduler(object): def _log_if_failed(self, future): exc = future.exception() if exc: - log.warn( + log.warning( "An internally scheduled tasked failed with an unhandled exception:", exc_info=exc) @@ -2077,8 +2077,8 @@ class ResponseFuture(object): if self._metrics is not None: self._metrics.on_other_error() # need to retry against a different host here - log.warn("Host %s is overloaded, retrying against a different " - "host", self._current_host) + log.warning("Host %s is overloaded, retrying against a different " + "host", self._current_host) self._retry(reuse_connection=False, consistency_level=None) return elif isinstance(response, IsBootstrappingErrorMessage): diff --git a/cassandra/connection.py b/cassandra/connection.py index b437e9d1..cb1c063c 100644 --- a/cassandra/connection.py +++ b/cassandra/connection.py @@ -181,9 +181,9 @@ class Connection(object): try: cb(new_exc) except Exception: - log.warn("Ignoring unhandled exception while erroring callbacks for a " - "failed connection (%s) to host %s:", - id(self), self.host, exc_info=True) + log.warning("Ignoring unhandled exception while erroring callbacks for a " + "failed connection (%s) to host %s:", + id(self), self.host, exc_info=True) def handle_pushed(self, response): log.debug("Message pushed from server: %r", response) diff --git a/cassandra/decoder.py b/cassandra/decoder.py index d09cca9c..fb9e3740 100644 --- a/cassandra/decoder.py +++ b/cassandra/decoder.py @@ -100,7 +100,7 @@ def decode_response(stream_id, flags, opcode, body, decompressor=None): trace_id = None if flags: - log.warn("Unknown protocol flags set: %02x. May cause problems.", flags) + log.warning("Unknown protocol flags set: %02x. May cause problems.", flags) msg_class = _message_types_by_opcode[opcode] msg = msg_class.recv_body(body) diff --git a/cassandra/pool.py b/cassandra/pool.py index 53d8898a..3988c30b 100644 --- a/cassandra/pool.py +++ b/cassandra/pool.py @@ -256,8 +256,8 @@ class _HostReconnectionHandler(_ReconnectionHandler): if isinstance(exc, AuthenticationFailed): return False else: - log.warn("Error attempting to reconnect to %s, scheduling retry in %f seconds: %s", - self.host, next_delay, exc) + log.warning("Error attempting to reconnect to %s, scheduling retry in %f seconds: %s", + self.host, next_delay, exc) log.debug("Reconnection error details", exc_info=True) return True @@ -368,7 +368,7 @@ class HostConnectionPool(object): try: self._add_conn_if_under_max() except (ConnectionException, socket.error) as exc: - log.warn("Failed to create new connection to %s: %s", self.host, exc) + log.warning("Failed to create new connection to %s: %s", self.host, exc) except Exception: log.exception("Unexpectedly failed to create new connection") finally: @@ -400,7 +400,7 @@ class HostConnectionPool(object): self._signal_available_conn() return True except (ConnectionException, socket.error) as exc: - log.warn("Failed to add new connection to pool for host %s: %s", self.host, exc) + log.warning("Failed to add new connection to pool for host %s: %s", self.host, exc) with self._lock: self.open_count -= 1 if self._session.cluster.signal_connection_failure(self.host, exc, is_host_addition=False):