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 "George Cooksey (JIRA)" <ji...@apache.org> on 2012/09/17 19:13:07 UTC

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

George Cooksey created LOG4PHP-189:
--------------------------------------

             Summary: 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


Christian Hammers has proposed to add the option of defining log file permissions as part of configuration:
http://www.nabble.com/Adding-umask-chmod-to-FileAppender--tt11748228.html#a11748228

--
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

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

Posted by "George Cooksey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Cooksey updated LOG4PHP-189:
-----------------------------------

    Description: 
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}

  was:
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_writable($file)) {
        chmod($file, 0755);
    }
    $this->setString('file', $file);
}
{code}

    
> 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

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

Posted by "George Cooksey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Cooksey updated LOG4PHP-189:
-----------------------------------

    Description: 
If a log file is not writeable, set default permissions in LoggerAppenderFile:

{code}
/**
 * Sets the file where the log output will go.
 * @param string $fileName
 * @deprecated Use setFile() instead.
 */
public function setFileName($fileName) {
    if (!is_writable($fileName)) {
        chmod($fileName, 0755);
    }
    $this->setFile($fileName);
}
{code}

  was:
Christian Hammers has proposed to add the option of defining log file permissions as part of configuration:
http://www.nabble.com/Adding-umask-chmod-to-FileAppender--tt11748228.html#a11748228

    
> 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 $fileName
>  * @deprecated Use setFile() instead.
>  */
> public function setFileName($fileName) {
>     if (!is_writable($fileName)) {
>         chmod($fileName, 0755);
>     }
>     $this->setFile($fileName);
> }
> {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

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

Posted by "George Cooksey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Cooksey updated LOG4PHP-189:
-----------------------------------

    Description: 
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_writable($file)) {
        chmod($file, 0755);
    }
    $this->setString('file', $file);
}
{code}

  was:
If a log file is not writeable, set default permissions in LoggerAppenderFile:


{code}
/**
 * Sets the file where the log output will go.
 * @param string $fileName
 * @deprecated Use setFile() instead.
 */
public function setFileName($fileName) {
    if (!is_writable($fileName)) {
        chmod($fileName, 0755);
    }
    $this->setFile($fileName);
}
{code}

    
> 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_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

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

Posted by "George Cooksey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Cooksey updated LOG4PHP-189:
-----------------------------------

    Description: 
If a log file is not writeable, set default permissions in LoggerAppenderFile:


{code}
/**
 * Sets the file where the log output will go.
 * @param string $fileName
 * @deprecated Use setFile() instead.
 */
public function setFileName($fileName) {
    if (!is_writable($fileName)) {
        chmod($fileName, 0755);
    }
    $this->setFile($fileName);
}
{code}

  was:
If a log file is not writeable, set default permissions in LoggerAppenderFile:

{code}
/**
 * Sets the file where the log output will go.
 * @param string $fileName
 * @deprecated Use setFile() instead.
 */
public function setFileName($fileName) {
    if (!is_writable($fileName)) {
        chmod($fileName, 0755);
    }
    $this->setFile($fileName);
}
{code}

    
> 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 $fileName
>  * @deprecated Use setFile() instead.
>  */
> public function setFileName($fileName) {
>     if (!is_writable($fileName)) {
>         chmod($fileName, 0755);
>     }
>     $this->setFile($fileName);
> }
> {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

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

Posted by "Sven Rautenberg (JIRA)" <ji...@apache.org>.
    [ 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