Tofu Optimist wrote:
I would like to append a small line of log information
to a file on certain apache2 requests. For this
application, I am very concerned about speed, so i'm
looking for fast simple solutions.


I could stuff the information in the error log as per
http://perl.apache.org/docs/2.0/api/Apache/Log.html, and parse it out later off-line, but I'd prefer to
reserve the error log for errors.


I could stuff the information in the access log, and
likewise pull out the data later off-line: how might I
get data to the access_log?

The most natural place to append the information would
be a dedicated file. I've never written to a file
from mod_perl, and don't know the correct idiom
(flock? etc?) to do so.


I'd appreciate any pointers to recipes, modules, etc.
to show me the correct (fast, reliable) way to append
to a file under MP2.

You may want to spend some time with the mp2 docs first. http://perl.apache.org/docs/2.0/user/

Your particular question is answered at these locations:
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlLogHandler
http://perl.apache.org/docs/2.0/user/handlers/server.html#Startup_Phases_Demonstration_Module

As for flocking, I prefer to do that, even though there are claims that short writes are atomic. It's probably not the same on all io implementations.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to