Ok, I have a nice iface, I have a (hopefully) good user authentication, I
have a DB up-and-running, and I have PHP 4.3.4 (yeah, I know, I will
update...).
What I need is a logging utility. And the question is: where to keep the
logs?
We (me and my buddy) have written everything from scratch (including
sessions support) - in a quest to learn something useful. Now we need to
decide where to keep our logs?
We can either keep them in a DB (already running, so no
setup/configuration needed here), or in a file.
Obviously, the file has an advantage over the DB - no overhead, less
queries. But here's the bad part: there will be ~500 users using this
site. It most certainly *will* happen that a few will use it
simultaneously.
So, we can flock() the file. Great. I can see the queue getting dreadfuly
long, the execution time getting dangerously near the limit and the
users getting mad on the other side of the cable.
Well, we don't have to flock() it. Fantastic - I can just imagine what
will happen if ~10 instaces of the script will try to write to this file
simultaneously. ..
Ok, we can can even write a "utility" script, that will get invoked by
the other scripts (with fopen(), not include()) and will do the actual
logging. But - isn't that just a other way for flock()? :)
Well, why don't we use the DB? Oh, right - the overhead...
Any ideas? I'm run out of mine...
Cheers
Mike
have a DB up-and-running, and I have PHP 4.3.4 (yeah, I know, I will
update...).
What I need is a logging utility. And the question is: where to keep the
logs?
We (me and my buddy) have written everything from scratch (including
sessions support) - in a quest to learn something useful. Now we need to
decide where to keep our logs?
We can either keep them in a DB (already running, so no
setup/configuration needed here), or in a file.
Obviously, the file has an advantage over the DB - no overhead, less
queries. But here's the bad part: there will be ~500 users using this
site. It most certainly *will* happen that a few will use it
simultaneously.
So, we can flock() the file. Great. I can see the queue getting dreadfuly
long, the execution time getting dangerously near the limit and the
users getting mad on the other side of the cable.
Well, we don't have to flock() it. Fantastic - I can just imagine what
will happen if ~10 instaces of the script will try to write to this file
simultaneously. ..
Ok, we can can even write a "utility" script, that will get invoked by
the other scripts (with fopen(), not include()) and will do the actual
logging. But - isn't that just a other way for flock()? :)
Well, why don't we use the DB? Oh, right - the overhead...
Any ideas? I'm run out of mine...
Cheers
Mike
Comment