Django logger is logging logs with two different time, sometime with GMT and sometime with IST. IST is the localtime. Setting has not been changed between these two logs.
django logger from settings is printing these two logs in file:
2021-04-19 06:30:00,061 DEBUG XXXXXXXXXXXXXX
2021-04-19 12:00:20,061 DEBUG XXXXXXXXXXXXXX
django settings files contains:
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Kolkata'
USE_I18N = True
USE_L10N = True
USE_TZ = False
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '{asctime} {levelname} {name}.{funcName}: {lineno} {message}',
'style': '{',
},
'simple': {
'format': '{levelname} {message}',
'style': '{',
},
},
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.handlers.TimedRotatingFileHandler',
'when': 'midnight', # this specifies the interval
'backupCount': 10, # how many backup file to keep, 10 days
'filename': '/xxx/django.log',
'formatter': 'verbose',
},
},
'loggers': {
'': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
'django': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
'django.db.backends': {
'handlers': ['file'],
'level': 'DEBUG',
},
'django.template': {
'handlers': ['file'],
'level': 'INFO',
'propagate': True,
},
},
}