What to do if your domain host does not allow you to read
the server log for your domain, stopping you from analyzing your website traffic the way you'd like to?
Well, create your own logfile of course !
I recently set up a new domain (coolt.nu, it's in Swedish,
you might not want to visit it :) and faced the problem that my domain host wouldn't generate
the statistics I wanted. I also found that they would not let me read/process the logfile myself.
Darn shame, but I did find a second-best solution: I created my own logfile. It didn't give me quite
as much information as I would have wanted, but I it had to be enough.
The only thing you can log from within PHP is actual hits, no errors, no '304 Not Modified'
and no 'Internal Server Error' entries can be generated, as your code will have to be executed
to be able to generate logfile entries. This was not a problem to me, because all I wanted to know
was which pages on my site got the actual hits, and when they occurred.
I ended up with a small script that extracted all the appropriate environment variables, put them
together as a Common Logfile Format entry and wrote it to a file. Good enough for me, because then I
could use any logfile analyzer that supports that format (and there's lots of those).