I’m running on a production server with WSGI & Apache.
I’m configuring a file logging for my Django project like:
settings.py
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
#...
'logfile': {
'class': 'logging.handlers.WatchedFileHandler',
'filename': '/var/log/django/my_project.log'
},
},
'loggers': {
#...
'django': {
'handlers': ['logfile'],
'level': 'ERROR',
'propagate': False,
},
}
}
How can I know which user should own the file /var/log/django/my_project.log ?
You may run the WSGI process as a specific user, e.g.:
Ideally to the one who owns
/var/log/django. (stat /var/log/django --printf=%U)