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 Florian Semm <fl...@gmx.de> on 2011/10/10 08:19:50 UTC

not null check in LoggerAppenderFile

Hi,

when I have a LoggerAppenderFile config without the option 'file', I got 
a warning:

Warning: mkdir() [<a href='function.mkdir'>function.mkdir</a>]: No such 
file or directory in 
C:\xampp\htdocs\Symfony-experimental\vendor\log4php\src\main\php\appenders\LoggerAppenderFile.php 
line 74

The appender execute mkdir(..) with $this->fileName = null/empty string.

I think there is a not null check missing in line LoggerAppenderFile:69

if ($fileName == null) throw Exception();


FS






Re: not null check in LoggerAppenderFile

Posted by Ivan Habunek <iv...@gmail.com>.
On 10.10.2011. 8:27, Florian Semm wrote:
> a warning is enough, that's right.
>
> to throw an exception was just an example to handle this

I see the problem. Since this is an appender issue, I will leave this 
for after I have merged the configurator changes from the experimental 
branch to the trunk (maybe by end of this week?).

If I start fixing appenders in the experimental branch it make merging 
it to trunk more difficult. Anyway, I have to go through all the 
appenders to see they work as documented (I know some don't) and to see 
that they trigger correct warnings and do not throw exceptions.

Opened an issue to remind myself:
https://issues.apache.org/jira/browse/LOG4PHP-158

Cheers,
Ivan

Re: not null check in LoggerAppenderFile

Posted by Florian Semm <fl...@gmx.de>.
Am 10.10.2011 08:22, schrieb Ivan Habunek:
> On 10.10.2011. 8:19, Florian Semm wrote:
>> Hi,
>>
>> when I have a LoggerAppenderFile config without the option 'file', I got
>> a warning:
>>
>> Warning: mkdir() [<a href='function.mkdir'>function.mkdir</a>]: No such
>> file or directory in
>> C:\xampp\htdocs\Symfony-experimental\vendor\log4php\src\main\php\appenders\LoggerAppenderFile.php 
>>
>> line 74
>>
>> The appender execute mkdir(..) with $this->fileName = null/empty string.
>>
>> I think there is a not null check missing in line LoggerAppenderFile:69
>>
>> if ($fileName == null) throw Exception();
>
> Thanks, will have a look. But won't throw an exception here, the idea 
> is to trigger a warning message and close the appender. We decided 
> that we don't really want log4php to crash peoples apps because it 
> cannot log.
>
> Regards,
> Ivan

a warning is enough, that's right.

to throw an exception was just an example to handle this

Re: not null check in LoggerAppenderFile

Posted by Ivan Habunek <iv...@gmail.com>.
On 10.10.2011. 8:19, Florian Semm wrote:
> Hi,
>
> when I have a LoggerAppenderFile config without the option 'file', I got
> a warning:
>
> Warning: mkdir() [<a href='function.mkdir'>function.mkdir</a>]: No such
> file or directory in
> C:\xampp\htdocs\Symfony-experimental\vendor\log4php\src\main\php\appenders\LoggerAppenderFile.php
> line 74
>
> The appender execute mkdir(..) with $this->fileName = null/empty string.
>
> I think there is a not null check missing in line LoggerAppenderFile:69
>
> if ($fileName == null) throw Exception();

Thanks, will have a look. But won't throw an exception here, the idea is 
to trigger a warning message and close the appender. We decided that we 
don't really want log4php to crash peoples apps because it cannot log.

Regards,
Ivan

Re: not null check in LoggerAppenderFile

Posted by Florian Semm <fl...@gmx.de>.
Am 10.10.2011 08:19, schrieb Florian Semm:
> Hi,
>
> when I have a LoggerAppenderFile config without the option 'file', I 
> got a warning:
>
> Warning: mkdir() [<a href='function.mkdir'>function.mkdir</a>]: No 
> such file or directory in 
> C:\xampp\htdocs\Symfony-experimental\vendor\log4php\src\main\php\appenders\LoggerAppenderFile.php 
> line 74
>
> The appender execute mkdir(..) with $this->fileName = null/empty string.
>
> I think there is a not null check missing in line LoggerAppenderFile:69
>
> if ($fileName == null) throw Exception();
>
>
> FS
>
>
>
>
>
i work with the experimental branch