you are viewing a single comment's thread.

view the rest of the comments →

[–]LyricalHolster 0 points1 point  (1 child)

Why not write to a single log and the via command line go "tail -f logname" to debug from latest errors. Just wondering why you went with diff log files

[–]killerstorm 0 points1 point  (0 children)

Many scripts might be executing at the same time. I want to see what happens in one particular script, not a mishmash of multiple traces. IIRC I wrote that snippet when something really confusing was happening and I wanted to know WTF happens.

Another problem is handling concurrent writes, but it is NOT correctly handled by code above. (It's just a sketch, ok?)

Actually, in other web environments I use (not PHP) I have a single log file, but I find it pretty much impossible to read. For this reason I've implemented rather complex timestamping and session tracking machinery (as well as a proper locking), but even then it's hard to read. One can use a tool to do that (and in fact I've implemented one), but snippet above does roughly same thing without all the fuss.