Logging with Django
Logging can be considered a record of every data in programming. Django uses Python’s built-in logging module (https://docs.python.org/3/library/logging.html) to capture logs. In Django, logging is configured as part of the general Django django.setup()
function, so it’s always available unless explicitly disabled. Python’s logging module provides extensive options to set up and configure logging; hence, all those configurations are also available when we use logging in Django. In this section, we shall learn how we can set up logging in Django and the best practices to use logging in Django projects.
Important note
Logging in Python is an extensive topic, and the configuration of logging can be tricky at times. In this section, we will not go into too much detail about how one can use all the different options provided by Python. Rather, we shall check the standard configuration, which I have used in multiple projects and have found to...