httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrej van der Zee" <>
Subject Re: apr_open_file and apr_write_file in post_read_request and log_transaction
Date Tue, 09 Sep 2008 15:21:18 GMT

Thanks for your reply.

I found that I memset() the req_cfg to 0 *after *I open the file. I am sorry
for wasting your time.... Anyway, please read on for more comments....

> Maybe you fail to open the file and the error is not logged correctly.
> ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "Failed to create
> resource log file: %s", req_cfg->filepath);
> instead of
> ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "Failed to create
> resource log file: %s", req_cfg->filepath);

What is the difference if I use r->server?

> Slightly off-topic, I think creating a file, writing to it, and
> closing it for each request is not an efficient solution. Can't you
> open just one single log file once for the whole server (in
> post_config for example), generate the unique id in post_read, put the
> ID in the request notes (the "notes" field of the request_rec
> structure) and then use it in log_transaction?

I am aware of this. The thing is that in my specific case a forked CGI
process will also write to the same file. If I use a unique file for every
request I am sure that I don't get scrambled eggs. If you know a better
solution, please tell me. Note, my module will not run in production
environments, its more a debugging module...


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message