How to convert django.request logger time to UTC?

孤人 提交于 2020-07-23 06:53:06

问题


I have an application in another TIME_ZONE, but I want to keep all generated logs in UTC.

I already defined my own Formatter for Python logging, and all logger calls that I have throughout the app, are all using UTC, but django.request logs, are still using locale's app timezone (both logs bellow, were generated by a single request):

Django Request Logger:

[10/Jun/2020 16:59:52] "POST /api/v1/report/ HTTP/1.1" 200 761

Application Logger:

[10/Jun/2020 23:00:02] INFO - REPORT_OK {'country': 'USA', 'ip': '127.0.0.1'}

How can I apply a similar approach to django.request logger?

来源:https://stackoverflow.com/questions/62314586/how-to-convert-django-request-logger-time-to-utc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!