[Twisted-Python] Log file ownership

Flavio Grossi flaviogrossi at ymail.com
Mon Jun 11 03:21:49 EDT 2012


 <exarkun <at> twistedmatrix.com> writes:


> 
> Log rotation - ie, renaming a file - isn't affected by the permissions 
> of the log file.  The permissions of the *directory containing the log 
> file* control whether it can be renamed (and a new one created) or not.
> 
> So it doesn't matter what permissions the log file has.  It only matters 
> what permissions you set on the directory holding the log file.  That's 
> outside of the control of twistd.

http://twistedmatrix.com/trac/browser/tags/releases/twisted-
12.0.0/twisted/python/logfile.py#L286

def rotate(self):
    if not (os.access(self.directory, os.W_OK) and os.access(self.path, 
os.W_OK)):
        return


it seems to also need write access to log file.

bye,
flavio


> 
> Jean-Paul
> 






More information about the Twisted-Python mailing list