> the typical way to do this is to add something to $r->notes and use the %{Foobar}n
Woohoo .. rock on .. this worked.

For posterity, here is what worked:
1) Add a note in the modperl code with the variable to be logged
sub append_to_log {
  my ($r, $plog) = @_;
  $r->notes->set('SYSINFO' => "&sysinfo=" . uri_escape(join("&", @{$plog})));
}

2) Modify the apache configuration so that you are logging the new variable. I also has to replace "%r" with "%m %U%q" since I needed to append to the URI)
LogFormat "%h %l %u %t \"%m %U%q%{SYSINFO}n %H\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

>
opening up $r->request_line() is probably acceptable.
Regarding this issue (and the follow on responses to it), my vote would go to making it writable again. Having old code work is huge for grunts like me. The approach above seems to have solved the major problem (logging the data) but is introducing side effects (for example, if I have not set a note for SYSINFO or if apache is serving a static file like index.html, it is getting logged as index.html-  -- notice the dash at the end).

Naive question: If making request_line writable again is accepted, when should it make it to a stable release ?

Thanks so much for your help guys. Really appreciate it.

- Alden.



Geoffrey Young wrote:
Can anyone suggest an alternate way of modifying the log entry ? 
    

the typical way to do this is to add something to $r->notes and use the %{Foobar}n

syntax as documented in

  http://httpd.apache.org/docs/2.0/mod/mod_log_config.html

in fact, there is a whole flood of variables you can use for this - so
many that you can fake $r->the_request() in a LogFormat with it's
various components.  see, for example, recipe 16.3 here:

  http://www.modperlcookbook.org/chapters/ch16.pdf

which shows both your method and an alternate way to achieve the same
thing.  you could certainly add what you want using these, I'd think.

  
In
other words, what way does MP2 allow for us to control what gets logged
to the Apache access_log ?
    

in general, mod_perl has nothing to do with this - you're using mod_perl
to be devious and change around what gets logged.  the proper approach
is probably to be straightforward about what you're logging.

  
Alternatively: Can the_request in Apache::RequestRec be made writable
again so that it works like before ?
    

  
From: http://search.cpan.org/dist/mod_perl/Changes
Apache::RequestRec methods changes [Stas] - readwrite => readonly:

   connection, canonical_filename, header_only, main, next, prev,
   pool, per_dir_config, request_config, proto_num, protocol,
   request_time, server, the_request, unparsed_uri
    

opening up $r->request_line() is probably acceptable.  I'd also consider
protocol and maybe proto_num (after researching what it is),
unparsed_uri, and perhaps header_only.  but that's about all.

thoughs from other devs?

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  

--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to