Closed teresantns closed 2 years ago
Currently the logging file is being displayed in the github repository, just for example sake. To change this, simply undo this commit i.e., add the .log extension to the gitignore file.
Now we have a file to track warning
and critical
logs on the API requests, that uses the django.request
extension, and another one to track the info
logs we will put on the custom views of our model.
Logging allows us to keep a record on data input, processes, and results in a program, so we can monitor the application.
We will use the built-in python
logging
library in connection todjango
to implement some basic logging our existing API. We will also use thepython-json-logger
library to format our loggers.python-json-logger
settings.py
fileLogging configuration:
django.requests
extension to log the API requestswarning
,info
anderror
to a filedebug
into another file or consoleI also used Gigek's django-drf-playground project to help me guide the best way to configure the logging.