Debugging features in Python can be enabled using environment variables. For more information on the available features and how to enable them, see the Debugging API reference.
Unlike other platforms, Python doesn't expose convenience methods to send pings on demand.
In case that is necessary, calling the
submit function for a given ping,
pings.custom_ping.submit(), will send it.
Glean offers two options for logging from Python:
- Simple logging API: A simple API that only allows for setting the logging level, but includes all Glean log messages, including those from its networking subprocess. This is also the only mode in which
GLEAN_LOG_PINGScan be used to display ping contents in the log.
- Flexible logging API: Full use of the Python
loggingmodule, including its features for redirecting to files and custom handling of messages, but does not include messages from the networking subprocess about HTTP requests.
You can set the logging level for Glean log messages by passing
Glean.initialize as follows:
from glean import Glean
If you want to see ping contents as well, set the
GLEAN_LOG_PINGS environment variable to
You can set the logging level for the Python logging to
DEBUG as follows:
All log messages from the Glean Python SDK are on the
glean logger, so if you need to control it independently, you can set a level for just the Glean Python SDK (but note that the global Python logging level also needs to be set as above):
The flexible logging API is unable to display networking-related log messages or ping contents with
GLEAN_LOG_PINGS set to true.
See the Python logging documentation for more information.