You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-user@logging.apache.org by Ryan Chan <ry...@gmail.com> on 2010/03/25 07:41:14 UTC
Is it safe to use LoggerAppenderFile in Apache (Prefork with multiple
running processes)
Hi, I want to verify if it is safe to use LoggerAppenderFile in Apache
(Prefork with multiple running processes).
What will happen if multiple apache processes are writing at the same time?
Exception, or just simply overwritten?
Re: Is it safe to use LoggerAppenderFile in Apache (Prefork with
multiple running processes)
Posted by Ryan Chan <ry...@gmail.com>.
Hi,
On Fri, Mar 26, 2010 at 2:09 AM, Christian Grobmeier
<gr...@gmail.com> wrote:
> No, the methods waits until it can get the lock. It does mean, that
> your execution will slow down on that position. Thats why a high load
> system should not have excessive logging enabled :-)
Sorry, because I cannot the any sentence on waiting in the doc:
http://php.net/manual/en/function.flock.php
anyway, I should do a testing.
Thanks.
Re: Is it safe to use LoggerAppenderFile in Apache (Prefork with
multiple running processes)
Posted by Christian Grobmeier <gr...@gmail.com>.
> According to the code, if LOCK_EX cannot be acquired immediately,
> does it mean some log will be dropped silently?
No, the methods waits until it can get the lock. It does mean, that
your execution will slow down on that position. Thats why a high load
system should not have excessive logging enabled :-)
Re: Is it safe to use LoggerAppenderFile in Apache (Prefork with
multiple running processes)
Posted by Ryan Chan <ry...@gmail.com>.
Hi.
On Thu, Mar 25, 2010 at 2:49 PM, Christian Grobmeier
<gr...@gmail.com> wrote:
> Look at this:
> http://logging.apache.org/log4php/coverage-report/appenders_LoggerAppenderFile.php.html#108
>
According to the code, if LOCK_EX cannot be acquired immediately,
does it mean some log will be dropped silently?
Re: Is it safe to use LoggerAppenderFile in Apache (Prefork with
multiple running processes)
Posted by Christian Grobmeier <gr...@gmail.com>.
Hi,
> Hi, I want to verify if it is safe to use LoggerAppenderFile in Apache
> (Prefork with multiple running processes).
I think it is
> What will happen if multiple apache processes are writing at the same time?
> Exception, or just simply overwritten?
Look at this:
http://logging.apache.org/log4php/coverage-report/appenders_LoggerAppenderFile.php.html#108
In the append method the file is written. As you can see we are using
locking to write to a file.
That means that process would we little time, if another process is
just writing.
For testing this is no problem.
For live enviroment with high load and much threads I would recommend
you to put your log level to a high one, f. e. ERROR or INFO
(depending on how much you write). Avoid DEBUG level in live
environments, because they can slow you down. BTW, this is true
general in logging area.
However, it will work (or its expected to do so).
Best regards,
Christian