Where do you want to collect your logs from?
Collect logs from your Django application.
Install Better Stack Python PyPI package:
Set up Django Better Stack handler in settings.py:
Use Python logger as usual:
You should see your logs in Better Stack β Live tail.
Python version 3.7 or higher is required.
Pip version 20.0.2 or higher is required.
Collect logs from your Python code.
Install Better Stack Python PyPI package:
Set up Python logger with Better Stack:
Use Python logger as usual:
You should see your logs in Better Stack β Live tail.
Python version 3.7 or higher is required.
Pip version 20.0.2 or higher is required.
Please let us know at hello@betterstack.com.
We're happy to help! π
Interested in learning more about Python log levels and using formatters to customize your logs? Check out our Comprehensive Guide to Logging in Python.
Make sure your application terminates gracefully, giving the logger enough time to finish the request to Better Stack.
Use sys.exit() to end your application.
Using os._exit() would terminate all threads immediately, potentially dropping your logs.
Add custom data to multiple log lines using with block:
Use logger.exception() to log exceptions with traceback:
Want to try a more detailed example?
See our Python Logtail example project on GitHub.
We use cookies to authenticate users, improve the product user experience, and for personalized ads. Learn more.