1

I have a python script being called by an svn post commit hook, and this python script needs to write to a log file using python logging. But the attempt to open the log file causes the script to fail. I am certain this is the reason because if I change from FileHandler to StreamHandler my script works perfectly.

Here is the log file I'm trying to write to:

-rw-rw-rw-. 1 apache   apache   1.8K Jan 22 10:15 hook_log.out

Here is it's parent directory, which is located in a subdirectory of /opt/:

drwxrwxrwx. 2 apache apache 4.0K Jan 22 10:33 svn_hooks

Now, for some reason, my script works perfectly if I log to a file in the root /tmp directory:

drwxrwxrwt.   8 root root 4.0K Jan 22 10:34 tmp

I cannot see why the /tmp directory should be writeable by the hook, while the svn_hooks/ direrectory is not. It belongs to apache and in any case it's writeable by everyone. Can anyone explain this to me? Thanks!

EDIT: the script fails on this line:

handler = logging.FileHandler("/opt/in1/svn_hooks/hook_log.out")
4

0 回答 0