[Twisted-Python] Log file ownership

Glyph glyph at twistedmatrix.com
Sun Jun 10 02:54:32 MDT 2012


On Jun 8, 2012, at 5:57 AM, exarkun at twistedmatrix.com wrote:

> On 7 Jun, 12:46 am, enriquejr at gmail.com wrote:
>> Hi,
>> 
>> I am running an app as root on Linux using a .tac file and twistd. The
>> application object is initialized with a certain gid and uid. Logging 
>> is
>> configured to rotate daily by way of DailyLogFile. However, the log 
>> file
>> it creates is owned by root with 600 file permission and log rotation 
>> is
>> failing. I have read about acl to configure default file permissions 
>> but
>> is there a way to solve this only in Twisted?
> 
> 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.

Perhaps twistd could emit a warning at startup though, and decline to rotate the log if it's impossible rather than logging an ugly traceback?



More information about the Twisted-Python mailing list