You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by "Sven Rautenberg (JIRA)" <ji...@apache.org> on 2012/09/18 19:28:08 UTC

[jira] [Commented] (LOG4PHP-189) Set default file permissions

    [ https://issues.apache.org/jira/browse/LOG4PHP-189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13457972#comment-13457972 ] 

Sven Rautenberg commented on LOG4PHP-189:
-----------------------------------------

Don't like it. :)

#1: is_writable() is false if the argument doesn't exist, I wouldn't check is_file() beforehand.

#2: Changing permissions is only allowed for the file owner. If the running log4php process cannot write the file, it is very likely that it hasn't created it, thus it is not the owner of the file. Changing permissions won't work then. On the other hand, if the log4php process owns the file, then it is unlikely that it was created without write permissions.

#3: I wouldn't expect the file permissions to be set to 755 if the running log4php process cannot write to the file. Even if file ownership would allow changing "other files", you'd run into the situation that log4php might only write to the file because it joins the file's group - removing write access for the group or the world would be unexpected.


                
> Set default file permissions
> ----------------------------
>
>                 Key: LOG4PHP-189
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-189
>             Project: Log4php
>          Issue Type: New Feature
>          Components: Code
>            Reporter: George Cooksey
>            Priority: Minor
>
> If a log file is not writeable, set default permissions in LoggerAppenderFile:
> {code}
> /**
>  * Sets the file where the log output will go.
>  * @param string $file
>  */
> public function setFile($file) {
>     if (is_file($file) && !is_writable($file)) {
>         chmod($file, 0755);
>     }
>     $this->setString('file', $file);
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira