@@ -3,6 +3,33 @@ Both sides
3
3
4
4
.. currentmodule :: websockets.asyncio.connection
5
5
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
+
6
33
What does ``ConnectionClosedError: no close frame received or sent `` mean?
7
34
--------------------------------------------------------------------------
8
35
@@ -39,8 +66,9 @@ There are several reasons why long-lived connections may be lost:
39
66
connections may terminate connections after a short amount of time, usually
40
67
30 seconds, despite websockets' keepalive mechanism.
41
68
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.
44
72
45
73
What does ``ConnectionClosedError: sent 1011 (internal error) keepalive ping timeout; no close frame received `` mean?
46
74
---------------------------------------------------------------------------------------------------------------------
0 commit comments