Django logfile rights issue

70 Views Asked by At

I have the following code in my setting file

    'logfile': {
        'level':'DEBUG',
        'class':'logging.handlers.RotatingFileHandler',
        'filename': LOG_ROOT + "/logfile",
        'maxBytes': 50000,
        'backupCount': 2,
        'formatter': 'standard'
    }

I have set the limit to 5MB, when it reaches to this level it creates new file but it has rights of root:root.

I want to set the rights of this file to www-data.

Any help should be appreciated.

1

There are 1 best solutions below

0
On

Maybe this might help you.

sudo chown www:data filename

The files created might have the property root:root because you execute this logfile tool with root privileges. If nothing helps, you might write a script that watches the new logs created and change the properties of it.