Collect logs directly from any Python code, including Django.
Logtail is a hosted service that centralizes all of your logs into one place. Allowing for analysis, correlation and filtering with SQL. Actionable Grafana dashboards and collaboration come built-in. Logtail works with any language or platform and any data source.
- Simple integration. Integrates with the Python
logginglibrary. - Support for structured logging and events.
- Automatically captures useful context.
- Performant, light weight, with a thoughtful design.
- Python 3.6.5 or newer
pip20.0.2 or newer
Install the Logtail Python client library using the pip command:
pip install logtail-pythonMake sure you install the logtail-python package and not a different package with the logtail keyword in the package name from a different author.
To help you get started with using Logtail in your Python projects, we have prepared a simple Python program that showcases the usage of Logtail logger.
You can download the example project from GitHub directly or you can clone it to a select directory. Then install the logtail-python client library as shown before:
pip install logtail-pythonTo run the example application, simply run the following command:
python main.py <source-token>Don't forget to replace <source-token> with your actual source token which you can find by going to logtail.com -> sources -> edit.
If you have trouble running the command above, check your Python installation and try running it with the python3 command instead. It should give you the following output:
Output:
All done! You can check your logs now.
This example project will create a total of 6 logs. Each corresponding to its respective method.
Learn how to setup Python logging by exploring the workings of the example project in detail.
Have any questions? Please explore the Logtail documentation or contact our support.
