I have a created a django logger settings. It is intended that console django.db.backends should not be applied to console. But it is printing in console as well.
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"verbose": {
"format": "%(levelname)s %(asctime)s %(module)s "
"%(process)d %(thread)d %(message)s"
}
},
"handlers": {
"file": {
"level": "DEBUG",
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": "debug/debug.log",
'when': 'W0', # Weekly log staring from Monday
'interval': 1,
'backupCount': 10,
},
"console": {
"level": "DEBUG",
"class": "logging.StreamHandler",
"formatter": "verbose",
},
},
"root": {"level": "INFO", "handlers": ["console"]},
"loggers": {
'django.db.backends': {
'level': 'DEBUG',
'handlers': ['file'],
}
},
}
This is my logger configuration. With this it is logging sql commands in file as well as console. I want this to be logged only for file. Please help if you have encountered this issue before.
Issue fixed when I added
propagate=Falsetodjango.db.backends