Skip to content

Commit 7b138bd

Browse files
committed
Add note how to see all logs, or none
1 parent db01181 commit 7b138bd

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

mavsdk/source/index.rst

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,55 @@ The examples assume that the embedded ``mavsdk_server`` binary can be run. In so
6969
Debug connection issues
7070
-----------------------
7171

72-
.. note::
73-
By default mavsdk-python will not print any output from mavsdk-server. If you are experiencing connection issues, it can pay to enable forwarding of the mavsdk-server output into the python console. You can do so with this piece of code at the top of your file:
72+
MAVSDK-Python automatically captures and displays important messages from ``mavsdk_server``. Error and warning messages are shown by default, while informational messages can be enabled for more detailed debugging.
7473

75-
.. code:: python
74+
**For basic debugging (recommended):**
7675

77-
import logging
78-
logging.basicConfig(level=logging.DEBUG)
76+
.. code:: python
77+
78+
import logging
79+
logging.basicConfig(level=logging.INFO)
80+
81+
This will show connection attempts, version information, and any errors or warnings from ``mavsdk_server``.
82+
83+
**For detailed debugging:**
84+
85+
.. code:: python
86+
87+
import logging
88+
logging.basicConfig(level=logging.DEBUG)
89+
90+
This shows all messages including internal debug information.
91+
92+
**For server-only messages:**
93+
94+
You can also control just the ``mavsdk_server`` output:
95+
96+
.. code:: python
97+
98+
import logging
99+
logging.basicConfig(level=logging.WARNING) # Hide most messages
100+
logging.getLogger('mavsdk_server').setLevel(logging.INFO) # Show server info
101+
102+
**To disable server messages completely:**
103+
104+
.. code:: python
105+
106+
import logging
107+
logging.getLogger('mavsdk_server').setLevel(logging.CRITICAL) # Hide all server output
108+
109+
**Common error messages:**
110+
111+
If you see error messages like these, they indicate connection string issues:
112+
113+
.. code:: bash
114+
115+
ERROR:mavsdk_server:Unknown protocol (cli_arg.cpp:62)
116+
ERROR:mavsdk_server:Connection failed: Invalid connection URL
117+
118+
Check that your connection string follows the correct format (e.g. ``udpin://0.0.0.0:14540``).
119+
120+
**Running mavsdk_server separately:**
79121

80122
In order to get more debugging information, it is possible to run the mavsdk_server binary separately.
81123

0 commit comments

Comments
 (0)