I need to daemonize a django module (using http://noah.org/wiki/Daemonize_Python).
At the start of the daemonize file, I do “import settings” (or “from django.conf import settings”) to get the stdout and stderr file names. When I call daemonize with those file names, ALL the logging is done to stderr and nothing is logged in to stdout. Anybody has an idea why it happens?
I use the standard django logging
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
'django.db.backends': {
'level': 'INFO',
},
}
}
Thanks!
You haven’t defined any handlers which log to stderr. See this example configuration to see how you can do that.
Update: In general, my answer is still correct. You need to provide a handler for the particular stream you want to output to.