@@ -3,6 +3,33 @@ Both sides
33
44.. currentmodule :: websockets.asyncio.connection
55
6+ .. _enable-debug-logs :
7+
8+ How do I enable debug logs?
9+ ---------------------------
10+
11+ You can enable debug logs to see exactly what websockets is doing.
12+
13+ If logging isn't configured in your application::
14+
15+ import logging
16+
17+ logging.basicConfig(
18+ format="%(asctime)s %(message)s",
19+ level=logging.DEBUG,
20+ )
21+
22+ If logging is already configured::
23+
24+ import logging
25+
26+ logger = logging.getLogger("websockets")
27+ logger.setLevel(logging.DEBUG)
28+ logger.addHandler(logging.StreamHandler())
29+
30+ Refer to the :doc: `logging documentation <../topics/logging >` for more details
31+ on logging in websockets.
32+
633What does ``ConnectionClosedError: no close frame received or sent `` mean?
734--------------------------------------------------------------------------
835
@@ -39,8 +66,9 @@ There are several reasons why long-lived connections may be lost:
3966 connections may terminate connections after a short amount of time, usually
4067 30 seconds, despite websockets' keepalive mechanism.
4168
42- If you're facing a reproducible issue, :ref: `enable debug logs <debugging >` to
43- see when and how connections are closed.
69+ If you're facing a reproducible issue, :ref: `enable debug logs
70+ <enable-debug-logs>` to see when and how connections are closed. connections are
71+ closed.
4472
4573What does ``ConnectionClosedError: sent 1011 (internal error) keepalive ping timeout; no close frame received `` mean?
4674---------------------------------------------------------------------------------------------------------------------
0 commit comments