make a new directory and put the file you write to in that directory and chmod 777 it then put a .htaccess file in the directory with these lines:
<Limit GET>
order deny,allow
Deny from all
</LIMIT>
That should work. It did for me 🙂 Then all you need 2 do is make your script that writes to the file point into the new directory.
Another way is to put the file outside your web directory. If you have your own server, and your document root is c:/webserver/htdocs (or woteva) then put it in a dir above (eg: c:/webserver) as these files are not accessable from the web but are by your php scripts.
However, if you don't have your own server, it may not be possible to go above your dir. With some hosts you can. If you have a public_html dir then put it above that or in a cgi-bin.
Hope that helps. The first method is easiest because you can keep all your non-public logs... in that directory 🙂