High performance logging - possible currently in PHP?
| From: | Nick Loman | Date: | Wed, 03 Jan 2001 00:30:10 +0000 |
| Subject: | High performance logging - possible currently in PHP? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-42758@lists.php.net to get a copy of this message | ||
I'm implementing a bespoke logging system where important tasks (rather
than page hits) are logged for future analysis.
Given that I'm hoping the function will be called on an extremely regular
basis I didn't want to implement this with file system calls where I open
append the log file each time as I expect the function to be called
hundreds of thousands of times a day and the log files to grow large.
In order that only one program had the log file open at the time I
implemented a very simple daemon coded in C which listened for connections
on localhost and took the data sent and write it to the log file which it
kept open at all times.
Thus I just implemented a quick PHP function call to
socket()/connect() and write() to that port when I want to log an event.
Question: is this the most efficient way of doing such a thing? I'm only a
little worried about the overhead from doing this but I was thinking
perhaps access to Apache's log routines/hijacking the httpd process to
keep persistent file handles open might be useful in future versions
of PHP. Is this possible already? Or is this a foolish idea? If not, can I
help implement it?
Thanks - keep up the great work.
Nick.