Skip to main content

Posts

Showing posts from September, 2017

Django grouping logs belonging to one request

Python has a very robust and easy to use logging framework. Django being a Python based web framework uses same logging as Python. To see how to implement logging in Django applications please follow this link of Django's official documentation site. In case you want me to explain how to implement logger in Django, feel free to put up a message in comments section and I will write a blog on it. Assuming you already have basic knowledge of implementing logger in Django, I will move forward with tutotrial. One problem I faced with logger of Django is tracing logs of a request through different apps of django. Request Response Cycle Django A typical request response cycle in Django would look like the image above. Now when a request hits middleware you may want to log something after that flow goes to application and in application there could be many modules through which our code flows. Now assume for a particular request we want to check what has happened through logs,