[
https://issues.apache.org/jira/browse/LOG4PHP-136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12997921#comment-12997921
]
David Pattison commented on LOG4PHP-136:
----------------------------------------
Hi,
I guess this does make sense. The warning won't stop program execution so it
could continue and it would notify (via error logs and such) that there is a
problem.
This was breaking some PHPUnit tests which assume that a warning is bad and
fails the test. The fix there was to fix permissions of the user/file.
I am going to resolve this issue.
Thanks,
Dave
> LoggerAppenderFile: Warning: fopen(target/examples/file.log): failed to open
> stream: Permission denied in /src/main/php/appenders/LoggerAppenderFile.php
> on line 77
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: LOG4PHP-136
> URL: https://issues.apache.org/jira/browse/LOG4PHP-136
> Project: Log4php
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Mac OSX, ubuntu 8.04, php 5.2.4
> Reporter: David Pattison
>
> LoggerAppenderFile emits a warning if it attempts to write to a log file that
> it doesn't have permissions for. It would be nice if that never happened but
> at least it should fail gracefully.
> Steps to reproduce:
> 1. cd src/examples
> 2. create "appender_file_fail.php" (from appender_file.php):
> <?php
> // START SNIPPET: doxia
> require_once dirname(__FILE__).'/../../main/php/Logger.php';
> Logger::configure(dirname(__FILE__).'/../resources/appender_file.properties');
> //make it fail by making the log file unwriteable
> system("touch target/examples/file.log");
> system("chmod 000 target/examples/file.log");
> $logger = Logger::getRootLogger();
> $logger->debug("Hello World!");//emits warning
> Can we add something to LoggerAppenderFile::activeOptions() such as:
> if (!is_writeable($fileName)) {
> //report error???
> $this->fp = false;
> return;
> }
> To check if it the file writeable. Then Log4PHP can fail nicely.
> -Dave
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira